perm filename LSPLOT.XGP[206,LSP] blob sn#476800 filedate 1979-09-24 generic text, type T, neo UTF8
/LMAR=0/XLINE=3/FONT#0=BAXL30[FNT,CLT]/FONT#1=BAXM30/FONT#2=BAXB30[FNT,CLT]/FONT#3=SUB/FONT#4=SUP/FONT#5=GACS25/FONT#6=FIX20/FONT#7=SYMB30[FNT,CLT]/FONT#8=FIX25/FONT#11=GRFX25/FONT#12=GRFX35/FONT#9=BEESIX















␈↓ ↓H␈↓	␈↓ ε≥LISP


␈↓ ↓H␈↓	␈↓ ε8at


␈↓ ↓H␈↓	␈↓ ε↔LOTS










␈↓ ↓H␈↓␈↓ β1Documentation of the Student version of MACLISP at LOTS

␈↓ ↓H␈↓␈↓ ¬BCompiled for CS206

␈↓ ↓H␈↓␈↓ ¬Hby  Carolyn Talcott

␈↓ ↓H␈↓␈↓ ¬GStanford University


␈↓ ↓H␈↓␈↓ βpThis version printed at 22:52 on September 24, 1979.
␈↓ ↓H␈↓␈↓ εH␈↓ ?i


␈↓ ↓H␈↓α␈↓ ¬NTable of Contents



␈↓ ↓H␈↓␈↓ 	Page



␈↓ ↓H␈↓Preface


␈↓ ↓H␈↓I␈↓ α_A MICRO-MANUAL FOR LISP - MOSTLY TRUTHFUL

␈↓ ↓H␈↓␈↓ α81␈↓ αxBasic notions.␈↓ ∧8   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓ ≠   1

␈↓ ↓H␈↓␈↓ α82␈↓ αxSome Useful Abbreviations.␈↓ ¬x   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓ ≠   2


␈↓ ↓H␈↓II␈↓ α_USING MACLISP AT LOTS

␈↓ ↓H␈↓␈↓ α81␈↓ αxIntroduction␈↓ ∧8   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓ ≠   4

␈↓ ↓H␈↓␈↓ α82␈↓ αxRunning LISP␈↓ ∧8   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓ ≠   6

␈↓ ↓H␈↓␈↓ α83␈↓ αxSuggestions for Homework Preparation.␈↓ εx   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓ ≠   8


␈↓ ↓H␈↓III␈↓ α_THE LISP EDITOR

␈↓ ↓H␈↓␈↓ α81␈↓ αxLISP Editor commands.␈↓ ¬8   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓ ≠   9

␈↓ ↓H␈↓␈↓ α82␈↓ αxExample session with the LISP Editor.␈↓ εx   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓    13


␈↓ ↓H␈↓IV␈↓ α_INPUT AND OUTPUT

␈↓ ↓H␈↓␈↓ α81␈↓ αxBasic I/O operations.␈↓ ¬8   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓    16

␈↓ ↓H␈↓␈↓ α82␈↓ αxFiles␈↓ βx   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓    17

␈↓ ↓H␈↓␈↓ α83␈↓ αxBasic I/O Operations Revisited.␈↓ ε8   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓    21

␈↓ ↓H␈↓␈↓ α84␈↓ αxI/O Examples.␈↓ ∧8   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .␈↓    23
␈↓ ↓H␈↓ii␈↓ ¬RTable of Contents␈↓ H


␈↓ ↓H␈↓A␈↓ α_MACLISP functions and features.
␈↓ ↓H␈↓␈↓ εH␈↓ ?i


␈↓ ↓H␈↓α␈↓ ε∃Preface


␈↓ ↓H␈↓        This␈α∞note␈α∞is␈α∞intended␈α∞as␈α∞an␈α∞introduction␈α∞to␈α∞the␈α∞use␈α∞of␈α∞the␈α∞student␈α∞version␈α∞of␈α∞MACLISP
␈↓ ↓H␈↓currently␈αavailable␈αat␈αthe␈αStanford␈αLOTS␈αComputing␈αCenter.␈α It␈αis␈αparticularly␈αaimed␈αat␈αstudents
␈↓ ↓H␈↓in CS206.

␈↓ ↓H␈↓        The␈αfirst␈αsection␈αis␈αa␈αMICRO␈αMANUAL␈αfor␈αLISP␈αwritten␈αby␈αJohn␈αMcCarthy.␈α It␈αcontains
␈↓ ↓H␈↓a␈α
description␈αof␈α
the␈αprimitives␈α
of␈αLISP,␈α
their␈α
semantics␈αand␈α
some␈αuseful␈α
abbreviations␈αfor␈α
pratical
␈↓ ↓H␈↓use.␈α∃ As␈α∃this␈α∃contains␈α∃discussion␈α∃of␈α∃only␈α∃the␈α∃very␈α∃basic␈α∃notions␈α∃of␈α∃LISP␈α∃it␈α∃is␈α∀essentially
␈↓ ↓H␈↓implementation␈α↔independent␈α⊗and␈α↔any␈α↔reasonable␈α⊗LISP␈α↔should␈α↔behave␈α⊗in␈α↔this␈α↔way␈α⊗(some
␈↓ ↓H␈↓abbreviations may have different names).

␈↓ ↓H␈↓        In␈αthe␈α
second␈αsection␈αwe␈α
give␈αsome␈α
directions␈αfor␈αusing␈α
the␈αstudent␈α
version␈αof␈αMACLISP␈α
at
␈↓ ↓H␈↓LOTS.␈α⊂ It␈α⊂differs␈α⊂from␈α⊂the␈α⊂system␈α⊂MACLISP␈α∂in␈α⊂minor␈α⊂(hopefully␈α⊂helpful)␈α⊂ways.␈α⊂ There␈α⊂is␈α∂a
␈↓ ↓H␈↓"photo"␈α
of␈α
a␈α
sample␈α
session␈αwith␈α
the␈α
LISP␈α
interpreter␈α
using␈αthe␈α
basic␈α
features␈α
that␈α
the␈αstudent␈α
will
␈↓ ↓H␈↓need.␈α Some␈αsuggestions␈αon␈αthe␈αmechanics␈αof␈αwriting,␈αdebugging,␈αand␈αpreparing␈αresults␈αto␈αturn␈αin
␈↓ ↓H␈↓as homework are also given.

␈↓ ↓H␈↓        The␈αthird␈αsection␈αcontains␈αdocumentation␈αfor␈αthe␈αeditor␈αavailable␈αin␈αthe␈αstudent␈αversion␈αof
␈↓ ↓H␈↓MACLISP␈αat␈αLOTS.␈α There␈αis␈αalso␈αa␈α"photo"␈αof␈αtwo␈αsessions␈αwith␈αthe␈αeditor.␈α In␈αthe␈αfirst␈αsession
␈↓ ↓H␈↓we␈αmodify␈αan␈αexisting␈αprogram.␈α In␈αthe␈αsecond␈αwe␈αbuild␈αa␈αprogram␈αfrom␈αscratch␈αwith␈αthe␈αaid␈αof
␈↓ ↓H␈↓the editor.

␈↓ ↓H␈↓        The␈α
fourth␈α∞section␈α
describes␈α∞Input/Output␈α
in␈α
MACLISP␈α∞and␈α
includes␈α∞a␈α
few␈α∞examples␈α
of
␈↓ ↓H␈↓the use of the I/O operations.

␈↓ ↓H␈↓        We␈α∩have␈α∩included␈α∩as␈α∩an␈α∩appendix␈α∩a␈α∩listing␈α∩of␈α∩MACLISP␈α∩functions,␈α∩features,␈α∩systerm
␈↓ ↓H␈↓variables, etc. valid for the TOPS-20 version of MACLISP.

␈↓ ↓H␈↓        For general documentation see the MACLISP reference manual.
␈↓ ↓H␈↓␈↓ εH␈↓ 91


␈↓ ↓H␈↓α␈↓ εSection I

␈↓ ↓H␈↓α␈↓ β@A MICRO-MANUAL FOR LISP - MOSTLY TRUTHFUL




␈↓ ↓H␈↓1.  ␈↓αBasic notions.␈↓


␈↓ ↓H␈↓        LISP␈α
data␈αare␈α
symbolic␈α
expressions␈αthat␈α
can␈αbe␈α
either␈α
␈↓↓atoms␈↓␈αor␈α
␈↓↓lists␈↓.␈α ␈↓↓Atoms␈↓␈α
are␈α
strings␈αof
␈↓ ↓H␈↓letters␈α⊃and␈α⊃digits␈α⊃and␈α⊃other␈α⊃characters␈α⊃not␈α⊃otherwise␈α⊂used␈α⊃in␈α⊃LISP.␈α⊃ A␈α⊃␈↓↓list␈↓␈α⊃consists␈α⊃of␈α⊃a␈α⊂left
␈↓ ↓H␈↓parenthesis␈αfollowed␈α
by␈αzero␈α
or␈αmore␈α
atoms␈αor␈αlists␈α
separated␈αby␈α
spaces␈αand␈α
ending␈αwith␈α
a␈αright
␈↓ ↓H␈↓parenthesis.  Examples: ␈↓¬A, ONION, (), (A), (A ONION A), (PLUS A (TIMES B ONION) 1)␈↓.

␈↓ ↓H␈↓        The␈α↔LISP␈α↔programming␈α↔language␈α↔is␈α↔defined␈α↔by␈α↔rules␈α↔for␈α↔␈↓↓evaluating␈↓␈α↔certain␈α⊗LISP
␈↓ ↓H␈↓expressions␈α∞to␈α
yield␈α∞other␈α
LISP␈α∞expressions␈α∞as␈α
their␈α∞values.␈α
 The␈α∞function␈α
␈↓↓value␈↓␈α∞used␈α∞in␈α
giving
␈↓ ↓H␈↓these␈α
rules␈α
is␈α
not␈α
part␈α
of␈α
the␈α
LISP␈α
language␈α
but␈α
rather␈α
part␈α
of␈α
the␈α
informal␈α
language␈α
in␈α
which
␈↓ ↓H␈↓LISP␈α
is␈αbeing␈α
defined.␈α
 Likewise,␈αthe␈α
italic␈α
letters␈α␈↓↓e␈↓␈α
and␈α
␈↓↓a␈↓␈α(sometimes␈α
with␈α
subscripts)␈αdenote␈α
LISP
␈↓ ↓H␈↓expressions,␈αthe␈αletter␈α␈↓↓v␈↓␈α(usually␈αsubscripted)␈αdenotes␈αan␈αatom␈αserving␈αas␈αa␈αvariable,␈αand␈αthe␈αletter
␈↓ ↓H␈↓␈↓↓f␈↓ stands for a LISP expression serving as a function name.

␈↓ ↓H␈↓1. ␈↓↓value (␈↓¬QUOTE ␈↓↓e) = e␈↓.  For example, the value of ␈↓¬(QUOTE A)␈↓ is ␈↓¬A␈↓.

␈↓ ↓H␈↓2.␈α∪␈↓↓value␈α∪(␈↓¬CAR␈α∪␈↓↓e)␈↓,␈α∪where␈α∪␈↓↓value␈α∪e␈↓␈α∪is␈α∀a␈α∪non-empty␈α∪list,␈α∪is␈α∪the␈α∪first␈α∪element␈α∪of␈α∀␈↓↓value e␈↓.␈α∪ Thus
␈↓ ↓H␈↓␈↓↓value ␈↓¬(CAR (QUOTE (A B C)))␈↓↓ = ␈↓¬A␈↓↓.␈α
 3.␈α
␈↓␈↓↓value␈↓␈α
(␈↓¬CDR␈α
␈↓e)␈↓↓,␈↓␈α
where␈α␈↓↓value␈α
e␈↓␈α
is␈α
a␈α
non-empty␈α
list,␈α
is␈αthe
␈↓ ↓H␈↓the␈αlist␈α
that␈αremains␈αwhen␈α
the␈αfirst␈α
element␈αof␈α␈↓↓value e␈↓␈α
is␈αdeleted.␈α Thus␈α
␈↓↓value ␈↓¬(CDR␈α(QUOTE␈α
(A␈αB
␈↓ ↓H␈↓¬C)))␈↓↓ = ␈↓¬(B C)␈↓↓.␈↓

␈↓ ↓H␈↓4.␈α
␈↓↓value␈α(␈↓¬CONS␈α
␈↓↓e1␈αe2)␈↓,␈α
is␈αthe␈α
list␈αthat␈α
results␈αfrom␈α
prefixing␈α␈↓↓value e1␈↓␈α
onto␈αthe␈α
list␈α
␈↓↓value e2␈↓.␈α Thus
␈↓ ↓H␈↓␈↓↓value ␈↓¬(CONS (QUOTE A) (QUOTE (B C)))␈↓↓ = ␈↓¬(A B C)␈↓↓.␈↓

␈↓ ↓H␈↓5.␈α∃␈↓↓value␈α∃(␈↓¬EQUAL␈α∃␈↓↓e1␈α∀e2)␈↓␈α∃is␈α∃␈↓¬T␈↓␈α∃if␈α∃␈↓↓value␈α∀e1␈α∃=␈α∃value␈α∃e2␈↓.␈α∀ Otherwise,␈α∃its␈α∃value␈α∃is␈α∃␈↓¬NIL␈↓.␈α∀ Thus
␈↓ ↓H␈↓␈↓↓value ␈↓¬(EQUAL (CAR (QUOTE (A B))) (QUOTE A))␈↓↓ = ␈↓¬T␈↓↓␈↓.

␈↓ ↓H␈↓6. ␈↓↓value (␈↓¬ATOM ␈↓↓e) = ␈↓¬T␈↓↓␈↓ if ␈↓↓value e␈↓ is an atom; otherwise its value is ␈↓¬NIL␈↓.

␈↓ ↓H␈↓7.␈α␈↓↓value␈α(␈↓¬COND␈α␈↓↓(p␈↓β1␈↓↓␈αe␈↓β1␈↓↓)␈α...␈α(p␈↓βn␈↓↓␈αe␈↓βn␈↓↓))␈α=␈αvalue␈αe␈↓βi␈↓↓␈↓,␈αwhere␈α␈↓↓p␈↓βi␈↓↓␈↓␈αis␈αthe␈αthe␈αfirst␈αof␈αthe␈α␈↓↓p␈↓'s␈αwhose␈αvalue␈αis␈αnot
␈↓ ↓H␈↓␈↓¬NIL␈↓.  Thus ␈↓↓value ␈↓¬(COND ((ATOM (QUOTE A)) (QUOTE B)) ((QUOTE T) (QUOTE C)))␈↓↓ = ␈↓¬B␈↓↓␈↓.

␈↓ ↓H␈↓8. An atom ␈↓↓v,␈↓ regarded as a variable, may have a value.

␈↓ ↓H␈↓9.␈α␈↓↓value␈α((␈↓¬LAMBDA␈α
␈↓↓(v␈↓β1␈↓↓␈α...␈αv␈↓βn␈↓↓)␈α
e)␈αe␈↓β1␈↓↓␈α...␈α
e␈↓βn␈↓↓)␈↓␈αis␈αthe␈αsame␈α
as␈α␈↓↓value e␈↓␈αbut␈α
in␈αan␈αenvironment␈α
in␈αwhich
␈↓ ↓H␈↓the␈α∞variables␈α∞␈↓↓v␈↓β1␈↓↓ ... v␈↓βn␈↓↓␈↓␈α∞take␈α∞the␈α∞values␈α∂of␈α∞the␈α∞expressions␈α∞␈↓↓e␈↓β1␈↓↓ ... e␈↓βn␈↓↓␈↓␈α∞in␈α∞the␈α∂original␈α∞environment.
␈↓ ↓H␈↓Thus
␈↓ ↓H␈↓␈↓↓value ␈↓¬((LAMBDA (X Y) (CONS (CAR X) Y)) (QUOTE (A B)) (CDR (QUOTE (C D))))␈↓↓ = ␈↓¬(A D)␈↓↓␈↓.

␈↓ ↓H␈↓10.␈α∩Here's␈α⊃the␈α∩hard␈α∩one.␈α⊃ ␈↓↓value␈α∩((␈↓¬LABEL␈α∩␈↓↓f␈α⊃(␈↓¬LAMBDA␈α∩␈↓↓(v␈↓β1␈↓↓␈α⊃...␈α∩v␈↓βn␈↓↓)␈α∩e))␈α⊃e␈↓β1␈↓↓␈α∩...␈α∩e␈↓βn␈↓↓)␈↓␈α⊃is␈α∩the␈α∩same␈α⊃as
␈↓ ↓H␈↓␈↓↓value ((␈↓¬LAMBDA␈α␈↓↓(v␈↓β1␈↓↓ ... v␈↓βn␈↓↓) e) e␈↓β1␈↓↓ ... e␈↓βn␈↓↓)␈↓,␈αbut␈αwhenever␈α␈↓↓(f a␈↓β1␈↓↓␈α... a␈↓βn␈↓↓)␈↓␈αmust␈αbe␈αevaluated,␈α␈↓↓f␈↓␈αis␈αreplaced
␈↓ ↓H␈↓by ␈↓↓(␈↓¬LABEL ␈↓↓f (␈↓¬LAMBDA ␈↓↓(v␈↓β1␈↓↓ ... v␈↓βn␈↓↓) e))␈↓.  Lists beginning with ␈↓¬LABEL ␈↓define functions recursively.
␈↓ ↓H␈↓2␈↓ ε
Section  I␈↓ H


␈↓ ↓H␈↓        This is the core of LISP, and here are more examples:

␈↓ ↓H␈↓␈↓ βr␈↓↓value ␈↓¬(CAR X)␈↓↓ = ␈↓¬(A B)␈↓↓␈↓ if ␈↓↓value ␈↓¬X␈↓↓ = ␈↓¬((A B) C)␈↓↓␈↓, and 

␈↓ ↓H␈↓␈↓ ↓}␈↓↓value␈↓¬((LABEL FF (LAMBDA (X) (COND ((ATOM X) X) ((QUOTE T) (FF (CAR X)))))) 
␈↓ ↓H␈↓ ¬↔␈↓¬(QUOTE ((A B) C)))␈↓↓ = ␈↓¬A␈↓↓.␈↓ 

␈↓ ↓H␈↓Thus␈α⊂␈↓¬((LABEL␈α∂FF␈α⊂(LAMBDA␈α∂(X)␈α⊂(COND␈α∂((ATOM␈α⊂X)␈α∂X)␈α⊂((QUOTE␈α∂T)␈α⊂(FF␈α∂(CAR␈α⊂X))))))␈↓,␈α⊂is␈α∂the
␈↓ ↓H␈↓LISP␈α
name␈αof␈α
a␈αfunction␈α
␈↓↓ff␈↓␈αsuch␈α
that␈α␈↓↓ff e␈↓␈α
is␈αthe␈α
first␈αatom␈α
in␈αthe␈α
written␈αform␈α
of␈α␈↓↓e.␈↓␈α
Note␈αthat␈α
the
␈↓ ↓H␈↓list ␈↓↓ff␈↓ is substituted for the atom ␈↓¬FF ␈↓twice in the course of evaluating the above expression.

␈↓ ↓H␈↓Difficult mathematical type exercise: Find a list ␈↓↓e␈↓ such that ␈↓↓value e = e␈↓.

␈↓ ↓H␈↓        You␈αmay␈α
now␈αprogram␈αin␈α
LISP.␈α Call␈αLISP␈α
system␈αon␈αa␈α
time-sharing␈αcomputer,␈αtype␈α
in␈αa
␈↓ ↓H␈↓list, and LISP will type back its value.



␈↓ ↓H␈↓2.  ␈↓αSome Useful Abbreviations.␈↓


␈↓ ↓H␈↓        The above LISP needs some abbreviations for practical use.

␈↓ ↓H␈↓1.␈αSo␈αas␈αnot␈αto␈αdescribe␈αa␈αLISP␈αfunction␈αeach␈αtime␈αit␈αis␈αused,␈αwe␈αdefine␈αit␈αpermanently␈αby␈αtyping
␈↓ ↓H␈↓␈↓↓(␈↓¬DEFUN␈α⊂␈↓↓f (v␈↓β1␈↓↓ ... v␈↓βn␈↓↓) e)␈↓.␈α∂ Thereafter␈α⊂␈↓↓(f e␈↓β1␈↓↓ ... e␈↓βn␈↓↓)␈↓␈α∂is␈α⊂evaluated␈α∂by␈α⊂evaluating␈α∂␈↓↓e␈↓␈α⊂with␈α⊂the␈α∂variables
␈↓ ↓H␈↓␈↓↓v␈↓β1␈↓↓, ... ,v␈↓βn␈↓↓␈↓␈α→taking␈α→the␈α→values␈α→␈↓↓value e␈↓β1␈↓↓, ... ,value e␈↓βn␈↓↓␈↓␈α→respectively.␈α→ Thus,␈α→after␈α→we␈α→define
␈↓ ↓H␈↓␈↓¬(DEFUN FF (X) (COND ((ATOM X) X) ((QUOTE T) (FF (CAR X)))))␈↓,␈α?␈α?␈α?␈α<typing
␈↓ ↓H␈↓␈↓¬(FF (QUOTE ((A B) C)))␈↓, gets ␈↓¬A␈↓ from LISP.

␈↓ ↓H␈↓2.␈αThe␈αvariables␈α␈↓¬T␈↓␈αand␈α␈↓¬NIL␈↓␈αare␈αpermanently␈αassigned␈αthe␈αvalues␈α␈↓¬T␈↓␈αand␈α␈↓¬NIL␈↓,␈αand␈α␈↓¬NIL␈↓␈αis␈αthe␈αname
␈↓ ↓H␈↓of␈α2the␈α2null␈α2list␈α2().␈α2 Therefore,␈α2the␈α2above␈α2definition␈α2can␈α2be␈α2written
␈↓ ↓H␈↓␈↓¬(DEFUN FF (X) (COND ((ATOM X) X) (T (FF (CAR X)))))␈↓.

␈↓ ↓H␈↓3. We have the permanent function definitions

␈↓ ↓H␈↓                ␈↓¬(DEFUN NULL (X) (EQUAL X NIL))␈↓ and ␈↓¬(DEFUN CADR (X) (CAR (CDR X)))␈↓,

␈↓ ↓H␈↓and similarly for arbitrary combinations of ␈↓¬A␈↓ and ␈↓¬D␈↓.

␈↓ ↓H␈↓4. ␈↓↓(␈↓¬LIST ␈↓↓e␈↓β1␈↓↓ ... e␈↓βn␈↓↓)␈↓ is defined for each ␈↓↓n␈↓ to be ␈↓↓(␈↓¬CONS ␈↓↓e␈↓β1␈↓↓ (␈↓¬CONS ␈↓↓... (␈↓¬CONS ␈↓↓e␈↓βn␈↓↓ ␈↓¬NIL␈↓↓)))␈↓.

␈↓ ↓H␈↓5.␈α␈↓↓(␈↓¬AND␈α␈↓↓p␈αq)␈↓␈αabbreviates␈α␈↓↓(␈↓¬COND␈α␈↓↓(p q) (␈↓¬T␈↓↓ ␈↓¬NIL␈↓↓))␈↓.␈α ␈↓¬AND␈↓s␈αwith␈αmore␈αterms␈αare␈αdefined␈αsimilarly,␈αand␈α
the
␈↓ ↓H␈↓propositional connectives ␈↓¬OR␈↓ and ␈↓¬NOT␈↓ abbreviate similar conditional expressions.

␈↓ ↓H␈↓        Now we can give some further examples of LISP function definitions:

␈↓ ↓H␈↓␈↓¬(DEFUN␈α∃ALT␈α⊗(X)␈α∃(COND␈α∃((OR␈α⊗(NULL␈α∃X)␈α∃(NULL␈α⊗(CDR␈α∃X)))␈α∃X)␈α⊗(T␈α∃(CONS␈α∃(CAR␈α⊗X)␈α∃(ALT
␈↓ ↓H␈↓¬(CDDR X))))))␈↓

␈↓ ↓H␈↓defines␈α∂a␈α∂function␈α∂that␈α∂gives␈α∂alternate␈α∂elements␈α∂of␈α∂a␈α∂list␈α∂starting␈α∂with␈α∂the␈α∂first␈α⊂element.␈α∂ Thus
␈↓ ↓H␈↓␈↓¬(ALT (QUOTE (A B C D E)))␈↓ = ␈↓¬(A C E)␈↓.
␈↓ ↓H␈↓␈↓ ε
Section  I␈↓ 93


␈↓ ↓H␈↓        ␈↓¬(DEFUN SUBST (X Y Z) (COND ((ATOM Z) (COND ((EQUAL Z Y) X) (T Z)))␈↓
␈↓ ↓H␈↓                                       ␈↓¬(T (CONS (SUBST X Y (CAR Z)) (SUBST X Y (CDR Z))))))␈↓

␈↓ ↓H␈↓gives the result of substituting ␈↓¬X␈↓ for ␈↓¬Y␈↓ in ␈↓¬Z␈↓.  Thus

␈↓ ↓H␈↓        ␈↓¬(SUBST␈α⊂(QUOTE␈α⊂(PLUS␈α⊂X␈α⊂Y))␈α⊂(QUOTE␈α⊂V)␈α⊂(QUOTE␈α⊂(TIMES␈α⊂X␈α⊂V)))␈↓␈α⊂=␈α⊂␈↓¬(TIMES␈α⊂X␈α⊂(PLUS␈α⊂X
␈↓ ↓H␈↓¬Y))␈↓.
␈↓ ↓H␈↓4␈↓ εH␈↓ H


␈↓ ↓H␈↓α␈↓ ε¬Section II

␈↓ ↓H␈↓α␈↓ ¬βUSING MACLISP AT LOTS




␈↓ ↓H␈↓1.  ␈↓αIntroduction␈↓


␈↓ ↓H␈↓        The␈α
student␈α
version␈α
of␈α∞MACLISP␈α
can␈α
be␈α
run␈α
at␈α∞LOTS␈α
 by␈α
typing␈α
"LISP"␈α
to␈α∞the␈α
LOTS
␈↓ ↓H␈↓monitor.␈α  In␈αgeneral␈αwhen␈αyou␈αinvoke␈αMACLISP␈αyou␈αare␈αasked␈αto␈αdecide␈αon␈αallocation␈αof␈αspace.
␈↓ ↓H␈↓In␈αthe␈αstudent␈αversion␈αthe␈α
allocation␈αof␈αvarious␈αspaces␈αhas␈αalready␈α
been␈αdone␈αin␈αthis␈αversion,␈αso␈α
it
␈↓ ↓H␈↓asks you no embarrassing questions.


␈↓ ↓H␈↓αEvaluating, errors, debugging.

␈↓ ↓H␈↓        As␈α∞with␈α∂other␈α∞LISP␈α∂interpreters,␈α∞the␈α∞top␈α∂level␈α∞is␈α∂a␈α∞read-eval-print␈α∞loop.␈α∂ Type␈α∞in␈α∂an␈α∞S-
␈↓ ↓H␈↓expression␈α
and␈α
LISP␈α
returns␈α
the␈αvalue.␈α
 MACLISP␈α
ordinarily␈α
does␈α
not␈α
distinguish␈αbetween␈α
upper
␈↓ ↓H␈↓and␈αlower␈αcase␈αletters.␈α It␈αvalues␈αare␈αnormally␈αprinted␈αin␈αupper␈αcase.␈α Thus␈αif␈αyou␈αtype␈α␈↓¬(quote␈αa)␈↓
␈↓ ↓H␈↓the␈αvalue␈αreturned␈α
will␈αbe␈α␈↓¬A.␈α
␈↓␈α(See␈αthe␈αsection␈α
on␈αI/O␈αfor␈α
exceptions.)␈αError␈αmessages␈α
and␈αother
␈↓ ↓H␈↓comments␈α⊂generated␈α⊂by␈α⊂the␈α⊂system␈α⊂are␈α⊂prefaced␈α⊂by␈α⊂a␈α⊂semi-colon.␈α⊂ When␈α⊂an␈α⊂error␈α⊂is␈α⊂detected,
␈↓ ↓H␈↓MACLISP␈α
prints␈αa␈α
message␈αsaying␈α
what␈αit␈α
thinks␈αis␈α
wrong,␈αand␈α
goes␈αinto␈α
a␈α"break-loop"␈α
allowing
␈↓ ↓H␈↓you␈αto␈αexamine␈αthe␈αenvironment␈αin␈αwhich␈αthe␈αerror␈αoccurred.␈α (This␈αfeature␈αis␈αdocumented␈αin␈αthe
␈↓ ↓H␈↓MACLISP␈α⊂reference␈α⊂manual.)  ␈α⊂To␈α⊃return␈α⊂to␈α⊂the␈α⊂top␈α⊃level␈α⊂type␈α⊂<control>G.␈α⊂ (Hold␈α⊃down␈α⊂the
␈↓ ↓H␈↓<control>␈α∞key␈α∂while␈α∞typing␈α∞"G".)  ␈α∂Sometimes␈α∞the␈α∞error␈α∂message␈α∞is␈α∞sufficient␈α∂to␈α∞tell␈α∞you␈α∂what␈α∞is
␈↓ ↓H␈↓wrong.␈α Often␈αit␈αis␈αnot.␈α There␈αare␈αsome␈αuseful␈αdebugging␈αaids␈αin␈αLISP.␈α In␈αparticular,␈αthe␈α␈↓¬TRACE
␈↓ ↓H␈↓¬␈↓and␈α∞␈↓¬STEP␈α∞␈↓facilities␈α∞are␈α∞helpful.␈α∞ If␈α∞you␈α∞␈↓¬(TRACE␈α∞FOO)␈↓␈α∞and␈α∞then␈α∞evaluate␈α∞␈↓¬(FOO␈α∞arg1␈α∞...␈α∞argn)␈↓,
␈↓ ↓H␈↓each␈α∞time␈α∞␈↓¬FOO␈α∞␈↓is␈α
called␈α∞the␈α∞values␈α∞of␈α∞the␈α
arguments␈α∞are␈α∞printed␈α∞and␈α
each␈α∞time␈α∞it␈α∞is␈α∞exited,␈α
the
␈↓ ↓H␈↓result␈α
is␈α
printed.␈α∞ To␈α
turn␈α
off␈α
the␈α∞trace␈α
type␈α
␈↓¬(UNTRACE␈α
FOO)␈↓.␈α∞  ␈↓¬STEP␈α
␈↓allows␈α
you␈α
to␈α∞step␈α
through
␈↓ ↓H␈↓the␈α
evaluation␈α∞of␈α
an␈α
expression.␈α∞ ␈↓¬TRACE␈α
␈↓and␈α∞␈↓¬STEP␈α
␈↓are␈α
 documented␈α∞in␈α
the␈α∞MACLISP␈α
reference
␈↓ ↓H␈↓manual.␈α
 We␈α
will␈αgive␈α
examples␈α
of␈αtheir␈α
use.␈α
  Try␈αthem␈α
out␈α
on␈αsome␈α
simple␈α
programs␈α
that␈αyou
␈↓ ↓H␈↓understand.


␈↓ ↓H␈↓αPretty-printing.

␈↓ ↓H␈↓        If␈α∞you␈α∞have␈α∞defined␈α∞a␈α∞program␈α∞(using␈α∞␈↓¬DEFUN␈↓␈α∞for␈α∞example)␈α∞then␈α∞you␈α∞can␈α∞"pretty-print"␈α∞it
␈↓ ↓H␈↓using␈α␈↓¬GRINDEF.␈α␈↓␈α A␈αpretty-printer␈αprints␈αthe␈αprogram␈αnicely␈αindented␈αto␈αexhibit␈αthe␈αstructure␈αof
␈↓ ↓H␈↓the␈αprogram.␈α ␈↓¬(GRINDEF f␈↓β1␈↓¬ ... f␈↓βn␈↓¬)␈↓␈α pretty␈αprints␈αthe␈αfunctional␈αand␈αvalue␈αproperties␈α(if␈αany)␈αof
␈↓ ↓H␈↓the␈α∞atoms␈α∂␈↓¬f␈↓βi␈↓¬␈↓.␈α∞ By␈α∂functional␈α∞propteries␈α∞we␈α∂mean␈α∞␈↓¬EXPR,␈α∂␈↓␈↓¬FEXPR,␈α∞␈↓␈↓¬MACRO,␈α∞␈↓etc.␈α∂ which␈α∞may␈α∂be␈α∞set
␈↓ ↓H␈↓using␈α␈↓¬DEFUN.␈α
␈↓␈αOrdinarily␈αand␈α
atom␈αhas␈α
at␈αmost␈αone␈α
of␈αthese␈αproperties,␈α
but␈αnothing␈α
prevents␈αit
␈↓ ↓H␈↓from having several.


␈↓ ↓H␈↓αSimple file I/O.

␈↓ ↓H␈↓        In␈α
addition␈αto␈α
printing␈α
definitions␈αon␈α
the␈α
terminal␈αyou␈α
will␈αwant␈α
to␈α
read␈αthem␈α
from␈α
a␈αfile
␈↓ ↓H␈↓and␈α∞write␈α∞them␈α∞onto␈α∞a␈α
file.␈α∞ This␈α∞version␈α∞of␈α∞MACLISP␈α
has␈α∞the␈α∞I/O␈α∞programs␈α∞␈↓¬DSKIN,␈α
␈↓␈↓¬QREAD,
␈↓ ↓H␈↓␈↓ ε¬Section  II␈↓ 95


␈↓ ↓H␈↓¬␈↓and␈α␈↓¬PPOUT.␈α␈↓␈α␈↓¬DSKIN␈α␈↓and␈α␈↓¬QREAD␈α␈↓do␈αfile␈αinput.␈α ␈↓¬DSKIN␈α␈↓expects␈αthat␈αthe␈αfile␈αcontains␈αa␈α
sequence␈αof
␈↓ ↓H␈↓S-expressions.␈α
 It␈α
reads,␈α
evaluates␈α
and␈α
prints␈α
the␈α
results␈α
repeatedly␈α
until␈α
the␈α
end-of-file␈αis␈α
reached.
␈↓ ↓H␈↓It␈α
returns␈α
the␈α
"file␈α
object"␈α
corresponding␈α
the␈α
that␈α
file.␈α
 (See␈α
Section␈α
IV␈α
for␈α
a␈α
discussion␈α
of␈α
files␈α
and
␈↓ ↓H␈↓file␈αobjects.)  ␈αThus␈α␈↓¬(DSKIN␈αFUNS␈αLSP)␈↓␈αreads␈αthe␈αfile␈αFUNS.LSP␈αon␈αthe␈αcurrent␈αdefault␈αdirectory.
␈↓ ↓H␈↓In␈α∀the␈α∀beginning␈α∀the␈α∀current␈α∀default␈α∃directory␈α∀is␈α∀your␈α∀directory.␈α∀ None␈α∀of␈α∀the␈α∃above␈α∀I/O
␈↓ ↓H␈↓operations␈α⊂change␈α⊂the␈α⊂default.␈α⊃ (See␈α⊂Section␈α⊂IV␈α⊂for␈α⊃discussion␈α⊂of␈α⊂setting␈α⊂and␈α⊃determining␈α⊂the
␈↓ ↓H␈↓current␈α∂defaults.)␈α∞To␈α∂read␈α∞a␈α∂file␈α∞from␈α∂some␈α∞other␈α∂directory,␈α∞say␈α∂from␈α∞the␈α∂CS206␈α∂directory␈α∞type
␈↓ ↓H␈↓␈↓¬(DSKIN (DSK |C.CS206|) FUNS LSP)␈↓.␈α  ␈↓¬(DSK |C.CS206|)␈↓␈α
is␈αthe␈α
directory␈αcomponent.␈α
 The␈α"|"s
␈↓ ↓H␈↓cause␈α
LISP␈αto␈α
treat␈α
all␈αcharacters␈α
alike␈α
thus␈αallowing␈α
" . ",␈α
" "(space),␈α"(",␈α
etc.␈α
to␈αoccur␈α
in␈α
a␈αname.
␈↓ ↓H␈↓␈↓¬QREAD␈α␈↓works␈αlike␈α
␈↓¬DSKIN␈α␈↓but␈αquietly.␈α
 It␈αreads␈αand␈α
evaluates,␈αbut␈αdoes␈α
not␈αprint.␈α Both␈α
are␈αuseful
␈↓ ↓H␈↓for reading in files containing program definitions.

␈↓ ↓H␈↓        To␈α
write␈α
the␈αdefinitions␈α
of␈α
␈↓¬BAX,␈α
␈↓␈↓¬BLETCH,␈α␈↓and␈α
␈↓¬MUMBLE␈α
␈↓on␈α
the␈αfile␈α
␈↓¬FOO.BAR␈α
␈↓in␈α
the␈αcurrent
␈↓ ↓H␈↓default directory type

␈↓ ↓H␈↓␈↓ ∧(␈↓¬(PPOUT (FOO BAR) BAX BLETCH MUMBLE).␈↓

␈↓ ↓H␈↓If␈α⊃you␈α⊃wish␈α⊂to␈α⊃do␈α⊃output␈α⊂on␈α⊃a␈α⊃directory␈α⊃other␈α⊂than␈α⊃the␈α⊃default␈α⊂the␈α⊃directory␈α⊃name␈α⊃must␈α⊂be
␈↓ ↓H␈↓included␈α
in␈α
the␈α∞file␈α
namelist.␈α
 (This␈α
may␈α∞cause␈α
an␈α
error␈α∞if␈α
you␈α
are␈α
not␈α∞allowed␈α
to␈α
write␈α∞on␈α
that
␈↓ ↓H␈↓directory.)␈α∞ ␈↓¬PPOUT␈α∞␈↓uses␈α
␈↓¬GRINDEF,␈α∞␈↓so␈α∞all␈α
functional␈α∞and␈α∞value␈α
properties␈α∞of␈α∞the␈α
atoms␈α∞in␈α∞the␈α
list
␈↓ ↓H␈↓will␈α
be␈αprinted␈α
in␈α
the␈αfile.␈α
 Nothing␈α
is␈αprinted␈α
on␈α
the␈αterminal␈α
and␈α
PPOUT␈αreturns␈α
the␈αfile␈α
object
␈↓ ↓H␈↓corresponding to the file written in.

␈↓ ↓H␈↓[Remark:  ␈↓¬PPOUT ␈↓creates a new file and any existing file of the same name will disappear.]


␈↓ ↓H␈↓αEditing.

␈↓ ↓H␈↓        This␈α
version␈α
is␈αsetup␈α
to␈α
use␈α
the␈αLISP␈α
program␈α
editor␈α
available␈αat␈α
SAIL␈α
rather␈α
than␈αthe␈α
one
␈↓ ↓H␈↓provided with the system.   Documentation and examples are in section III of this manual.


␈↓ ↓H␈↓αExiting.

␈↓ ↓H␈↓        To exit LISP type <control>C.
␈↓ ↓H␈↓6␈↓ ε¬Section  II␈↓ H


␈↓ ↓H␈↓2.  ␈↓αRunning LISP ␈↓


␈↓ ↓H␈↓        The␈αfollowing␈αis␈αthe␈αlog␈αof␈αa␈αsession␈αwith␈αLISP␈αat␈αLOTS.␈α Things␈αin␈αlower␈αcase␈αare␈αtyped
␈↓ ↓H␈↓by␈α∂the␈α∂user␈α∂and␈α∂those␈α∂in␈α∂UPPER␈α∂case␈α∂are␈α∂generated␈α∂by␈α∂LISP.␈α∂ A␈α∂single␈α∂semicolon␈α∂";"␈α∂flags␈α∂a
␈↓ ↓H␈↓comment made by LISP. A triple semicolon ";;;" flags a comment made by the user.

␈↓ ↓H␈↓¬@lisp 
␈↓ ↓H␈↓¬MACLISP Here!
␈↓ ↓H␈↓¬NIL 

␈↓ ↓H␈↓¬t                               ;;; evaluating some constants
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬nil
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬1
␈↓ ↓H␈↓¬1 
␈↓ ↓H␈↓¬10
␈↓ ↓H␈↓¬10 
␈↓ ↓H␈↓¬10.                             ;;; MACLISP works base 8, 
␈↓ ↓H␈↓¬12                              ;;; a dot after an integer means base 10
␈↓ ↓H␈↓¬(car '(a . b))
␈↓ ↓H␈↓¬A 
␈↓ ↓H␈↓¬(car (cons 'a 'b))
␈↓ ↓H␈↓¬A 
␈↓ ↓H␈↓¬(null 'a)
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬(atom 'a)
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬(eq 'b (cdr (cons 'a 'b)))
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬(append '(1) ())
␈↓ ↓H␈↓¬(1) 
␈↓ ↓H␈↓¬(append '(1) '(2))
␈↓ ↓H␈↓¬(1 2) 
␈↓ ↓H␈↓¬(append '(a) 'b)
␈↓ ↓H␈↓¬(A . B) 
␈↓ ↓H␈↓¬(append 'a ())                  
␈↓ ↓H␈↓¬;A ILLEGAL DATUM - CAR
␈↓ ↓H␈↓¬;BKPT WRNG-TYPE-ARG
␈↓ ↓H␈↓¬(boundp u)                      ;;;u is not bound just after error
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬(boundp v)                      ;;;v is bound  to NIL
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬v
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬QUIT                            ;;;exit break loop
␈↓ ↓H␈↓¬* 
␈↓ ↓H␈↓¬(trace append)          ;;;see what we can find out by looking at the TRACE
␈↓ ↓H␈↓¬;Loading trace 65
␈↓ ↓H␈↓¬(APPEND) 

␈↓ ↓H␈↓¬(append '(a) ())                ;;; first try something that succeeds
␈↓ ↓H␈↓¬(1 ENTER APPEND ((A) NIL)) 
␈↓ ↓H␈↓¬  (2 ENTER APPEND (NIL NIL)) 
␈↓ ↓H␈↓¬  (2 EXIT APPEND NIL) 
␈↓ ↓H␈↓¬(1 EXIT APPEND (A)) 
␈↓ ↓H␈↓¬(A) 
␈↓ ↓H␈↓␈↓ ε¬Section  II␈↓ 97



␈↓ ↓H␈↓¬(append 'a ())                  ;;; now look at the bad one
␈↓ ↓H␈↓¬(1 ENTER APPEND (A NIL)) 
␈↓ ↓H␈↓¬;A ILLEGAL DATUM - CAR          ;;; fails in first call
␈↓ ↓H␈↓¬;BKPT WRNG-TYPE-ARG
␈↓ ↓H␈↓¬QUIT
␈↓ ↓H␈↓¬* 
␈↓ ↓H␈↓¬(untrace append)                ;;; untrace and
␈↓ ↓H␈↓¬(APPEND) 
␈↓ ↓H␈↓¬(step t)                        ;;; step through the evaluation
␈↓ ↓H␈↓¬EVALHOOK* 
␈↓ ↓H␈↓¬(append 'a ())
␈↓ ↓H␈↓¬(APPEND (QUOTE A) NIL)          ;;; type a <space> when the stepper types 
␈↓ ↓H␈↓¬  (QUOTE A)                     ;;; out the next expression to evaluate
␈↓ ↓H␈↓¬  A                             ;;; to continue stepping
␈↓ ↓H␈↓¬  NIL
␈↓ ↓H␈↓¬  (COND ((NULL U) V) (T (CONS # #))) 
␈↓ ↓H␈↓¬    (NULL U) 
␈↓ ↓H␈↓¬      U = A
␈↓ ↓H␈↓¬    NIL
␈↓ ↓H␈↓¬    (CONS (CAR U) (APPEND (CDR U) V)) 
␈↓ ↓H␈↓¬      (CAR U) 
␈↓ ↓H␈↓¬        U = A
␈↓ ↓H␈↓¬;A ILLEGAL DATUM - CAR          ;;; aha!  APPEND does not work if
␈↓ ↓H␈↓¬                                ;;; the first argument is not a list.
␈↓ ↓H␈↓¬;BKPT WRNG-TYPE-ARG
␈↓ ↓H␈↓¬QUIT
␈↓ ↓H␈↓¬* 

␈↓ ↓H␈↓¬;;; The file <c.cs206>EXAMPL.F79 contains the definition of 
␈↓ ↓H␈↓¬;;; APPEND, FLATTEN, FLAT, FRINGE, SUBST, and SUBST#

␈↓ ↓H␈↓¬(dskin (dsk |c.cs206|) exampl f79)      ;;; Read the file EXAMPL.F79 from
␈↓ ↓H␈↓¬                                        ;;; the <C.CS206> directory
␈↓ ↓H␈↓¬APPEND                                  ;;; DSKIN reports the value of each
␈↓ ↓H␈↓¬FLATTEN                                 ;;; expression it reads.
␈↓ ↓H␈↓¬FLAT 
␈↓ ↓H␈↓¬FRINGE 
␈↓ ↓H␈↓¬SUBST 
␈↓ ↓H␈↓¬SUBST# 
␈↓ ↓H␈↓¬#FILE-IN-|DSK:<c.cs206>EXAMPL.F79|-64776    ;;; It returns the file object.

␈↓ ↓H␈↓¬(crunit)                                 ;;; The LISP name of my directory
␈↓ ↓H␈↓¬(DSK |C.CLT|) 

␈↓ ↓H␈↓¬(ppout (subst lsp) subst subst#)        ;;; Pretty-print the definitions of 
␈↓ ↓H␈↓¬                                        ;;; SUBST and SUBST# in the file 
␈↓ ↓H␈↓¬                                        ;;; SUBST.LSP on my directory. PPOUT
␈↓ ↓H␈↓¬                                        ;;; returns the corresponding
␈↓ ↓H␈↓¬#FILE-OUT-|DSK:<C.CLT>SUBST.LSP|-64764  ;;; file object.

␈↓ ↓H␈↓¬(qread subst lsp)                       ;;; read SUBST.LSP on my directory,
␈↓ ↓H␈↓¬#FILE-IN-|DSK:<C.CLT>APP.LSP|-64752     ;;; quietly.   QREAD also returns 
␈↓ ↓H␈↓¬                                        ;;; the file object.
␈↓ ↓H␈↓8␈↓ ε¬Section  II␈↓ H


␈↓ ↓H␈↓3.  ␈↓αSuggestions for Homework Preparation.␈↓


␈↓ ↓H␈↓        Some␈αof␈αthe␈αhomework␈αfor␈αCS206␈αinvolves␈αwriting␈αLISP␈αprograms␈αto␈αcompute␈αsome␈αgiven
␈↓ ↓H␈↓recursive␈α∞functions.␈α
 The␈α∞student␈α∞is␈α
expected␈α∞to␈α∞debug␈α
the␈α∞programs␈α∞then␈α
turn␈α∞in␈α∞the␈α
following
␈↓ ↓H␈↓things for each program:

␈↓ ↓H␈↓        1.  The internal form of the program.
␈↓ ↓H␈↓        2.  The corresponding external form recursive definition.
␈↓ ↓H␈↓        3.  A description of how the progam works and why.
␈↓ ↓H␈↓        4.  Output from test runs on a variety of input.

␈↓ ↓H␈↓This␈α
collection␈α
of␈α
data␈α
can␈α∞be␈α
put␈α
together␈α
in␈α
many␈α∞ways.␈α
 The␈α
following␈α
procedure␈α
is␈α∞just␈α
one
␈↓ ↓H␈↓possiblity.

␈↓ ↓H␈↓␈↓ αλ1.␈α Using␈αsome␈αeditor␈αavailable␈αat␈αLOTS␈αcreate␈αa␈αfile␈αand␈αtype␈αin␈αthe␈αprograms␈αyou␈αwish␈αto
␈↓ ↓H␈↓␈↓ αHtest.␈α∪ This␈α∩allows␈α∪you␈α∩to␈α∪use␈α∩the␈α∪editor␈α∩to␈α∪correct␈α∩typos.␈α∪  Parenthesis␈α∪matching␈α∩is
␈↓ ↓H␈↓␈↓ αHessential here, so check it carefully.

␈↓ ↓H␈↓␈↓ αλ2.␈α When␈α
you␈αthink␈αyour␈α
programs␈αare␈αcorrectly␈α
written␈αrun␈α
LISP␈αand␈αread␈α
in␈αthe␈αfile␈α
(using
␈↓ ↓H␈↓␈↓ αH␈↓¬DSKIN␈α␈↓or␈α␈↓¬QREAD␈↓).␈α Now␈αtry␈αyour␈α
functions␈αon␈αsome␈αtrivial␈αcases.␈α  If␈αyou␈α
discover␈αsome
␈↓ ↓H␈↓␈↓ αHbugs␈αfix␈αthem␈αusing␈αthe␈αLISP␈αeditor␈αand␈αsave␈αthem␈αusing␈α␈↓¬PPOUT␈α␈↓to␈αcreate␈αa␈αtemporary
␈↓ ↓H␈↓␈↓ αHfile␈αwhich␈αcan␈αlater␈αbe␈αappended␈αto␈αthe␈αoriginal.␈α (Alternately␈αyou␈αcan␈αrewrite␈αthe␈α
entire
␈↓ ↓H␈↓␈↓ αHfile␈α
if␈αnot␈α
too␈α
large.)  ␈αNow␈α
test␈α
them␈αon␈α
non␈αtrivial␈α
data␈α
until␈αyou␈α
are␈α
convinced␈αthey
␈↓ ↓H␈↓␈↓ αHare correct.

␈↓ ↓H␈↓␈↓ αλ3.␈α⊂ To␈α⊂get␈α⊂output␈α⊂from␈α⊂sample␈α⊂runs␈α⊂the␈α⊂LOTS␈α⊂"PHOTO"␈α⊂program␈α⊂is␈α⊂useful.␈α⊂ PHOTO
␈↓ ↓H␈↓␈↓ αHcreates␈αa␈αfile␈αin␈αwhich␈αit␈αkeeps␈αa␈αlog␈αof␈αwhat␈αyou␈αtype␈αto␈αthe␈αterminal␈αand␈αwhat␈αit␈αtypes
␈↓ ↓H␈↓␈↓ αHback.  Type HELP PHOTO to the monitor to find out how to use it.

␈↓ ↓H␈↓␈↓ αλ4.␈α Finally␈αyou␈αcan␈αedit␈αthe␈αfile␈αcontaining␈αthe␈αpretty␈αprinted␈αversions␈αof␈αyour␈αprograms␈αand
␈↓ ↓H␈↓␈↓ αHadd␈α∂external␈α∂form␈α∂definitions␈α∞and␈α∂documentation␈α∂for␈α∂each␈α∞program,␈α∂list␈α∂this␈α∂and␈α∞the
␈↓ ↓H␈↓␈↓ αHPHOTO file and turn them in.

␈↓ ↓H␈↓There␈α
are␈α
many␈α
variations␈α
on␈α
the␈α
above␈α
procedure.␈α
 You␈α
will␈α
no␈α
doubt␈α
develop␈α
your␈α∞own␈α
style
␈↓ ↓H␈↓and␈αpreferences.␈α This␈αis␈αintended␈αonly␈αto␈αget␈αyou␈αgoing␈αand␈αpoint␈αout␈αsome␈αof␈αthe␈αpossibilities␈α
in
␈↓ ↓H␈↓the case that you are unfamiliar with LOTS, LISP or both.
␈↓ ↓H␈↓␈↓ εH␈↓ 99


␈↓ ↓H␈↓α␈↓ ¬}Section III

␈↓ ↓H␈↓α␈↓ ¬=THE LISP EDITOR


␈↓ ↓H␈↓        The␈α∞ LISP␈α∞Editor␈α∞was␈α∂written␈α∞by␈α∞R.P.Gabriel␈α∞and␈α∞T.Finin.␈α∂ It␈α∞is␈α∞a␈α∞structural␈α∂editor␈α∞that
␈↓ ↓H␈↓runs␈αin␈αthe␈αMACLISP␈αinterpreter.␈α The␈αeditor␈αis␈αuseful␈αfor␈αmodifying␈αprograms␈αalready␈αdefined,
␈↓ ↓H␈↓for␈α∂constructing␈α∂a␈α∂program␈α∂from␈α∂scratch,␈α⊂or␈α∂for␈α∂editing␈α∂other␈α∂expressions,␈α∂or␈α⊂properties.␈α∂  The
␈↓ ↓H␈↓editor␈α∂assumes␈α⊂that␈α∂the␈α∂expressions␈α⊂it␈α∂is␈α∂dealing␈α⊂with␈α∂are␈α∂hierarchical␈α⊂list␈α∂structures,␈α∂e.␈α⊂g.␈α∂lists
␈↓ ↓H␈↓whose␈α
elements␈αare␈α
either␈αatoms␈α
or␈αother␈α
lists.␈α
 The␈αeditor␈α
knows␈αabout␈α
a␈αtop␈α
level␈αexpression␈α
and
␈↓ ↓H␈↓a␈αcurrent␈αexpression␈α(CE)␈αwhich␈αis␈αa␈αsubexpression␈αof␈αthe␈αtop␈αlevel␈αexpression.␈α Initially␈αthey␈αare
␈↓ ↓H␈↓the␈α⊂same.␈α⊃ (Proceed␈α⊂at␈α⊃your␈α⊂own␈α⊃risk␈α⊂if␈α⊂you␈α⊃try␈α⊂to␈α⊃edit␈α⊂a␈α⊃random␈α⊂S-expression.)␈α⊃Among␈α⊂the
␈↓ ↓H␈↓possible␈α
operations␈α∞are:␈α
change␈α∞the␈α
CE,␈α
add,␈α∞or␈α
delete␈α∞elements␈α
of␈α
the␈α∞CE,␈α
move␈α∞parentheses␈α
in
␈↓ ↓H␈↓and␈α
out␈α
to␈α
change␈α
the␈αsubexpression␈α
structure,␈α
or␈α
change␈α
the␈αCE␈α
by␈α
moving␈α
up,␈α
down␈αor␈α
sideways
␈↓ ↓H␈↓within␈α
the␈α
toplevel␈α
expression.␈α
 It␈α
is␈α
also␈α
possible␈α
to␈α
move␈α
around␈α
in␈α
the␈α
expression␈α
by␈αsearching␈α
a
␈↓ ↓H␈↓match to a pattern.

␈↓ ↓H␈↓        The␈αdocumentation␈α
that␈αfollows␈αis␈α
largley␈αtaken␈α
from␈αthe␈αonline␈α
documentation␈αof␈αthe␈α
LISP
␈↓ ↓H␈↓editor at the Stanford University AI Lab.



␈↓ ↓H␈↓1.  ␈↓αLISP Editor commands.␈↓


␈↓ ↓H␈↓α␈↓ ¬BInvoking the Editor

␈↓ ↓H␈↓        There␈αare␈αvarious␈α
ways␈αto␈αinvoke␈αthe␈α
editor␈αcorresponding␈αto␈α
different␈αways␈αof␈αforming␈α
the
␈↓ ↓H␈↓top level expression to be edited.

␈↓ ↓H␈↓1). ␈↓ ↓x(EDIT␈α
 FOO)␈α
 edit␈α
 the␈α
in-core␈α
function␈α
"FOO"␈α
.␈α
 The␈α
top␈α
level␈α
expression␈α
becomes␈α
(DEFUN
␈↓ ↓H␈↓␈↓ αλFOO <bvars> <body>), if the EXPR property of FOO is (LAMBDA <bvars> <body>).

␈↓ ↓H␈↓2). ␈↓ ↓x(EDIT1 <exp>) will make <exp> the toplevel editable expression.

␈↓ ↓H␈↓3). ␈↓ ↓x(EDIT2␈α∂<var>)␈α∂will␈α∞ make␈α∂(PROG2␈α∂(SETQ␈α∞<var>␈α∂<current␈α∂value␈α∞of␈α∂var>)␈α∂T)␈α∂the␈α∞toplevel
␈↓ ↓H␈↓␈↓ αλwhile␈α~(EDIT2␈α→(GET␈α~<var>␈α→<indicator>))␈α~will␈α→make␈α~it:␈α→(DEFPROP␈α~<var>␈α→<value>
␈↓ ↓H␈↓␈↓ αλ<indicator>).

␈↓ ↓H␈↓α␈↓ ∧≤How to Look at the Current Expression (CE)

␈↓ ↓H␈↓P␈↓ β8prints␈α the␈α
 CE␈α using␈α
 the␈α current␈α
print␈αdepth␈α
(sublist␈αcutoff)␈α
and␈αprint␈α
length
␈↓ ↓H␈↓␈↓ αH(length cutoff)

␈↓ ↓H␈↓PP␈↓ β8pretty-prints the entire CE

␈↓ ↓H␈↓PS␈↓ β8pretty-prints the CE using the print depth cutoff

␈↓ ↓H␈↓W␈↓ β8prints␈αthe␈α
"window"␈αsurrounding␈α
the␈αCE.␈α
Thus␈αif␈α
window␈αsize␈α
is␈α2,␈α
it␈αprints␈α
the
␈↓ ↓H␈↓␈↓ αH2␈αpreceeding␈αand␈α2␈αfollowing␈αtokens␈αaround␈αthe␈αCE,␈αwhere␈α"token"␈αmeans␈αexpression␈αor
␈↓ ↓H␈↓␈↓ αHparenthesis.
␈↓ ↓H␈↓10␈↓ ¬␈Section  III␈↓ H


␈↓ ↓H␈↓(WINDOW n)␈↓ β8changes the window size to n.

␈↓ ↓H␈↓(PL n)␈↓ β8changes the print length to n (initially 5)

␈↓ ↓H␈↓(PD n)␈↓ β8changes the print depth to n (initially 2)

␈↓ ↓H␈↓α␈↓ ¬SChanging the CE

␈↓ ↓H␈↓(CR E1...En)␈↓ β8changes the  CE  to  E1...En  (i.e. splices  in E1...En, and makes the CE E1.

␈↓ ↓H␈↓(n E1...En)␈↓ β8n>0, changes the n-th  element  of  the  CE  to  E1...En

␈↓ ↓H␈↓(n E1...En)␈↓ β8n<0 changes the n-th element of the CE from the end to E1...En

␈↓ ↓H␈↓(n)␈↓ β8n>0 deletes the n-th element of the CE

␈↓ ↓H␈↓(n)␈↓ β8n<0, deletes the n-th element from the end

␈↓ ↓H␈↓RI␈↓ β8moves the right parenthesis in one expression

␈↓ ↓H␈↓RO␈↓ β8moves the right parenthesis out one expression

␈↓ ↓H␈↓LI␈↓ β8similar to RI

␈↓ ↓H␈↓LO␈↓ β8similar to RO

␈↓ ↓H␈↓DELETE␈↓ β8deletes␈α∂the␈α∂CE␈α∂ (if␈α∂ the␈α∂ CE␈α∞ is␈α∂ the␈α∂ toplevel␈α∂expression,␈α∂the␈α∂Editor␈α∞assumes
␈↓ ↓H␈↓␈↓ αHthat the user wants to edit a different function and requests:

␈↓ ↓H␈↓  (function name <file specifications>):

␈↓ ↓H␈↓Valid responses are:

␈↓ ↓H␈↓␈↓ αλ1)  FOO - loads FOO from core
␈↓ ↓H␈↓␈↓ αλ4)  NEW - gives a fresh top-level expression
␈↓ ↓H␈↓␈↓ αλ5)  cntrl-G - quits back to the Editor command decoder
␈↓ ↓H␈↓␈↓ αλ6)  UNDO - <see below>.

␈↓ ↓H␈↓[Note:␈α∂the␈α∂Editor␈α∂is␈α∂designed␈α∂to␈α∂be␈α∂able␈α∂to␈α∂get␈α∂definitions␈α∂from␈α∂files,␈α∂but␈α∂the␈α∂current␈α∂editor␈α∞is
␈↓ ↓H␈↓incompatible with NEWIO in the current version of MACLISP.]

␈↓ ↓H␈↓α␈↓ ∧HMoving around within the Expression

␈↓ ↓H␈↓n␈↓ β8n>0 makes the new CE the n-th element of the CE
␈↓ ↓H␈↓n␈↓ β8n<0, makes the new CE the n-th element from the end  of the CE
␈↓ ↓H␈↓↑␈↓ β8makes the CE the immediate parent of the CE
␈↓ ↓H␈↓TOP␈↓ β8makes the CE the toplevel expression
␈↓ ↓H␈↓NX␈↓ β8makes the CE the next one after the CE
␈↓ ↓H␈↓BK␈↓ β8makes the CE the one before the CE
␈↓ ↓H␈↓␈↓ ¬␈Section  III␈↓ *11


␈↓ ↓H␈↓α␈↓ ¬AAdding Expressions

␈↓ ↓H␈↓(A n E1...En)␈↓ β8puts E1...En after the n-th element of the CE
␈↓ ↓H␈↓(B n E1...En)␈↓ β8puts E1...En before the n-th element of the CE
␈↓ ↓H␈↓(AI E1...En)␈↓ β8puts E1...En after the CE and makes E1 the new CE
␈↓ ↓H␈↓(BI E1...En)␈↓ β8puts E1...En before the CE and  makes  E1  the new CE
␈↓ ↓H␈↓(R exp1 exp2)␈↓ β8replaces all occurrences of exp1 with exp2  in the CE, viewed as a list,
␈↓ ↓H␈↓␈↓ β8returns nil? if no occurrences found
␈↓ ↓H␈↓(TR exp1 exp2)␈↓ β8replaces all occurrences of exp1 with exp2  in the CE, viewed as a tree

␈↓ ↓H␈↓α␈↓ ∧'Finding Expressions (i.e. changing the CE)


␈↓ ↓H␈↓(F pat)␈↓ β8finds the next occurrence of  pat,  searching  in print order
␈↓ ↓H␈↓(BF pat)␈↓ β8finds the next occurrence of  pat,  searching  in inverse print order
␈↓ ↓H␈↓(F pat T)␈↓ β8finds the next occurrence of pat but looks at the topmost  elements
␈↓ ↓H␈↓␈↓ β8of the CE first (useful for getting to PROG tags)
␈↓ ↓H␈↓(BF pat T)␈↓ β8similar to above
␈↓ ↓H␈↓(F pat n)␈↓ β8finds the n-th occurrence of pat
␈↓ ↓H␈↓(BF pat n)␈↓ β8similar to above
␈↓ ↓H␈↓F␈↓ β8finds the next  occurrence  of  the  last  search pattern
␈↓ ↓H␈↓BF␈↓ β8similar to above

␈↓ ↓H␈↓        Pat, as used above, can contain any of the following:

␈↓ ↓H␈↓α␈↓ ε⊂Patterns

␈↓ ↓H␈↓Element of pat␈↓ ∧8What it matches
␈↓ ↓H␈↓------- -- ---␈↓ ∧8---- -- -------

␈↓ ↓H␈↓atom␈↓ ∧8atoms EQ to it
␈↓ ↓H␈↓list␈↓ ∧8calls matcher recursively
␈↓ ↓H␈↓?␈↓ ∧8any   atom   or   single   list (i.e. an s-expression)
␈↓ ↓H␈↓?X␈↓ ∧8any  element;   binds   ?X   to whatever it matched
␈↓ ↓H␈↓*␈↓ ∧8any non-empty string of elements
␈↓ ↓H␈↓*X␈↓ ∧8matches as *, but binds *X to the list of elements it matched
␈↓ ↓H␈↓=?X␈↓ ∧8whatever ?X matched last time
␈↓ ↓H␈↓=*X␈↓ ∧8whatever *X matched last time
␈↓ ↓H␈↓(RESTRICT  ?   P1...Pn)␈↓ ∧8any  element  satisfying  the predicates P1,...,Pn
␈↓ ↓H␈↓(RESTRICT ?X P1...Pn)␈↓ ∧8similar to above but  binds  ?X to what it matched.

␈↓ ↓H␈↓[Note:␈α(A␈α?X␈αIS␈αA␈α?X)␈αmatches␈α(a␈αword␈αis␈α a␈α word)␈α but␈αnot␈α(a␈αword␈αis␈αa␈αsentence).␈α Simlarly␈αfor
␈↓ ↓H␈↓(*X is a *X).]

␈↓ ↓H␈↓α␈↓ ¬5Invoking the Matcher

␈↓ ↓H␈↓(MATCH pat)␈↓ β8attempts to match pat against the CE
␈↓ ↓H␈↓(MATCH pat var1 ... varn)
␈↓ ↓H␈↓␈↓ β8attempts to match pat against the CE while retaining the
␈↓ ↓H␈↓␈↓ β8values of the variables var1,..., varn.
␈↓ ↓H␈↓␈↓ β8(E.g. (MATCH (* *A *B ?A) *A ?A).
␈↓ ↓H␈↓12␈↓ ¬␈Section  III␈↓ H


␈↓ ↓H␈↓MATCH␈↓ β8attempts to match the last pat against the CE. Like F and BF above.
␈↓ ↓H␈↓REMATCH␈↓ β8attempts to get the next match of pat against the CE.
␈↓ ↓H␈↓␈↓ β8Usually this only makes sense if pat contains some * variables.
␈↓ ↓H␈↓(REMATCH var1 ... varn)
␈↓ ↓H␈↓␈↓ β8rematches but will retain var1,...,varn.

␈↓ ↓H␈↓α␈↓ ¬8Hairy Matching Uses

␈↓ ↓H␈↓(PR pat)␈↓ β8replaces the CE with the  instantiation  of pat
␈↓ ↓H␈↓␈↓ β8(substitutes the values of ?-variables and *-variables)
␈↓ ↓H␈↓(PA n P1...Pn)␈↓ β8similar to (A n E1...En)
␈↓ ↓H␈↓(PB n P1...Pn)␈↓ β8similar to (B n E1...En)
␈↓ ↓H␈↓(PAI P1...Pn)␈↓ β8similar to (AI E1...En)
␈↓ ↓H␈↓(PRA exp1 pat)␈↓ β8similar to (R exp1 exp2)
␈↓ ↓H␈↓(TPRA exp1 pat)␈↓ β8similar to (TR exp1 exp2)

␈↓ ↓H␈↓α␈↓ ¬XExiting and Etc.


␈↓ ↓H␈↓REMEMBER␈↓ β8puts the  toplevel  expression under the "draft" property
␈↓ ↓H␈↓␈↓ β8(preserves  DEFUN  format  and comments)
␈↓ ↓H␈↓OK␈↓ β8REMEMBER's  and   EVAL's   the toplevel expression
␈↓ ↓H␈↓␈↓ β8(i.e. defines the function  as well as remembers it)
␈↓ ↓H␈↓EXIT                exits the Editor (to the LISP toplevel)

␈↓ ↓H␈↓α␈↓ ¬JNone of the above.

␈↓ ↓H␈↓Any other command is handed to LISP to be EVAL'ed.
␈↓ ↓H␈↓␈↓ ¬␈Section  III␈↓ *13


␈↓ ↓H␈↓2.  ␈↓αExample session with the LISP Editor.␈↓


␈↓ ↓H␈↓        Here␈α∂are␈α∂some␈α∞things␈α∂you␈α∂can␈α∞do␈α∂using␈α∂the␈α∞LISP␈α∂Editor.␈α∂ The␈α∞user␈α∂types␈α∂in␈α∂lower␈α∞case,
␈↓ ↓H␈↓LISP␈αreplys␈αin␈αupper␈αcase,␈α";;;"␈αflags␈αa␈αuser␈α
comment,␈α";"␈αa␈αLISP␈αcomment.␈α ←␈αis␈αthe␈αeditor␈α
prompt.
␈↓ ↓H␈↓It␈αbegins␈α
a␈αcommand␈α
line.␈α Several␈αcommands␈α
may␈αappear␈α
on␈αa␈αline.␈α
 The␈αeditor␈α
processes␈αthem
␈↓ ↓H␈↓sequentially.␈α∞ Refer␈α
to␈α∞the␈α
above␈α∞documentation␈α
if␈α∞you␈α
don't␈α∞remember␈α
what␈α∞the␈α∞commands␈α
are
␈↓ ↓H␈↓supposed␈α∂to␈α∂do.␈α∂ #␈α∞is␈α∂used␈α∂to␈α∂denote␈α∞structure␈α∂not␈α∂shown␈α∂when␈α∞printing␈α∂the␈α∂skeleton␈α∂of␈α∂an␈α∞S-
␈↓ ↓H␈↓expression.


␈↓ ↓H␈↓αModifying an existing program

␈↓ ↓H␈↓¬;;; Modify APPEND to test for atoms in general not just NIL.
␈↓ ↓H␈↓¬;;; Assume that APPEND has been DEFUNed already.

␈↓ ↓H␈↓¬(edit append)
␈↓ ↓H␈↓¬;loading EDIT.110 
␈↓ ↓H␈↓¬;LOADING GRIND 412
␈↓ ↓H␈↓¬RPG-EDIT 

␈↓ ↓H␈↓¬← pp
␈↓ ↓H␈↓¬;Loading GRINDEF 425 
␈↓ ↓H␈↓¬(DEFUN APPEND (U V) 
␈↓ ↓H␈↓¬    (COND ((NULL U) V) (T (CONS (CAR U) (APPEND (CDR U) V)))))

␈↓ ↓H␈↓¬← (f null)  (cr atom) p
␈↓ ↓H␈↓¬ATOM 
␈↓ ↓H␈↓¬← ↑  p
␈↓ ↓H␈↓¬(ATOM U) 
␈↓ ↓H␈↓¬← ↑  p
␈↓ ↓H␈↓¬((ATOM U) V) 
␈↓ ↓H␈↓¬← bk  p
␈↓ ↓H␈↓¬COND 
␈↓ ↓H␈↓¬← ↑  p
␈↓ ↓H␈↓¬(COND (# V) (T #)) 
␈↓ ↓H␈↓¬← bk  p
␈↓ ↓H␈↓¬(U V) 
␈↓ ↓H␈↓¬← (1 x)  p
␈↓ ↓H␈↓¬(X V) 
␈↓ ↓H␈↓¬← nx  p
␈↓ ↓H␈↓¬(COND (# V) (T #)) 
␈↓ ↓H␈↓¬← (r u x) pp
␈↓ ↓H␈↓¬(COND ((ATOM X) V) (T (CONS (CAR X) (APPEND (CDR X) V))))
␈↓ ↓H␈↓¬← top  p
␈↓ ↓H␈↓¬(DEFUN APPEND (X V) (COND # #)) 
␈↓ ↓H␈↓¬← (r append appx) pp
␈↓ ↓H␈↓¬(DEFUN APPX (X V) 
␈↓ ↓H␈↓¬    (COND ((ATOM X) V) (T (CONS (CAR X) (APPX (CDR X) V)))))
␈↓ ↓H␈↓¬← ok 
␈↓ ↓H␈↓¬APPX 

␈↓ ↓H␈↓¬;;;Any expression not recognized as an edit command will be EVALed
␈↓ ↓H␈↓¬← (appx 'a ())
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬← (appx '(a . b) '(c))
␈↓ ↓H␈↓¬(A C) 
␈↓ ↓H␈↓14␈↓ ¬␈Section  III␈↓ H


␈↓ ↓H␈↓¬← (appx '(a  b . c) 'c)
␈↓ ↓H␈↓¬(A B . C) 

␈↓ ↓H␈↓¬;;; Some alternate ways to invoke the Editor
␈↓ ↓H␈↓¬← (setq u '(a b c d))
␈↓ ↓H␈↓¬(A B C D) 
␈↓ ↓H␈↓¬← (edit1 u) p
␈↓ ↓H␈↓¬(A B C D) 
␈↓ ↓H␈↓¬← (edit2 u) pp
␈↓ ↓H␈↓¬(PROG2 (SETQ U '(A B C D)) T)
␈↓ ↓H␈↓¬ 
␈↓ ↓H␈↓␈↓ ¬␈Section  III␈↓ *15


␈↓ ↓H␈↓αConstructing a program using the editor.

␈↓ ↓H␈↓¬;;; Construct the program SUBST (see section I.)

␈↓ ↓H␈↓¬← (edit2 (get subst expr)) pp           ;;; First define the empty program
␈↓ ↓H␈↓¬(DEFPROP SUBST NIL EXPR)
␈↓ ↓H␈↓¬← (3 (lambda (x y z) (cond ()())) ) p   ;;; Replace by a skeleton
␈↓ ↓H␈↓¬(DEFPROP SUBST (LAMBDA # #) EXPR) 
␈↓ ↓H␈↓¬← 3  p
␈↓ ↓H␈↓¬(LAMBDA (X Y Z) (COND NIL NIL)) 
␈↓ ↓H␈↓¬← 3  2  (b 1 (atom z) ())   p           ;;; Partially fill in first clause
␈↓ ↓H␈↓¬((ATOM Z) NIL)                          ;;; of the conditional.
␈↓ ↓H␈↓¬← 2  (cr (cond ()()))  p                ;;; The skeleton of the value part
␈↓ ↓H␈↓¬(COND NIL NIL) 
␈↓ ↓H␈↓¬← (2 ((eq y z) x)) p                    
␈↓ ↓H␈↓¬(COND (# X) NIL) 
␈↓ ↓H␈↓¬← (a 2 t z) p
␈↓ ↓H␈↓¬(COND (# X) T Z NIL) 
␈↓ ↓H␈↓¬← 5  lo  lo  p
␈↓ ↓H␈↓¬(T Z) 
␈↓ ↓H␈↓¬← ↑  ↑  pp
␈↓ ↓H␈↓¬((ATOM Z) (COND ((EQ Y Z) X) (T Z)))
␈↓ ↓H␈↓¬← nx  p                                 ;;; Go to second clause.
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬← (cr (t (cons (subst) (subst)))) p     ;;; Partially fill in 2nd clause
␈↓ ↓H␈↓¬(T (CONS # #)) 
␈↓ ↓H␈↓¬← 2  (a 2 x y (car x)) 2  ro  ro  ro  pp  ;;; Fill in arguments once
␈↓ ↓H␈↓¬(SUBST X Y (CAR X))
␈↓ ↓H␈↓¬← 4  (2 z)  p                           ;;; correct the mistake
␈↓ ↓H␈↓¬(CAR Z) 
␈↓ ↓H␈↓¬← nx
␈↓ ↓H␈↓¬nil?                                    ;;; there is no next expression
␈↓ ↓H␈↓¬← ↑ nx p
␈↓ ↓H␈↓¬(SUBST) 
␈↓ ↓H␈↓¬← (a 1 x y (cdr z))  p                  ;;; Fill in arguments again
␈↓ ↓H␈↓¬(SUBST X Y (CDR Z)) 
␈↓ ↓H␈↓¬← ↑ pp
␈↓ ↓H␈↓¬(CONS (SUBST X Y (CAR Z)) (SUBST X Y (CDR Z)))
␈↓ ↓H␈↓¬← top  pp                               ;;; Now to view our work
␈↓ ↓H␈↓¬(DEFPROP SUBST
␈↓ ↓H␈↓¬     (LAMBDA (X Y Z) 
␈↓ ↓H␈↓¬             (COND ((ATOM Z) (COND ((EQ Y Z) X) (T Z)))
␈↓ ↓H␈↓¬                   (T (CONS (SUBST X Y (CAR Z)) (SUBST X Y (CDR Z))))))
␈↓ ↓H␈↓¬ EXPR)
␈↓ ↓H␈↓¬← ok                            ;;; make this the official definition
␈↓ ↓H␈↓¬SUBST 

␈↓ ↓H␈↓¬;;; Try it out
␈↓ ↓H␈↓¬← (subst ''(a . b) 'x  '(cons (car x) (cdr x)))
␈↓ ↓H␈↓¬(CONS (CAR (QUOTE (A . B))) (CDR (QUOTE (A . B)))) 
␈↓ ↓H␈↓¬← (eval (subst ''(a . b) 'x  '(cons (car x) (cdr x))))
␈↓ ↓H␈↓¬(A . B) 
␈↓ ↓H␈↓16␈↓ εH␈↓ H


␈↓ ↓H␈↓α␈↓ εSection IV

␈↓ ↓H␈↓α␈↓ ¬%INPUT AND OUTPUT


␈↓ ↓H␈↓        There␈α∩are␈α∪three␈α∩components␈α∩to␈α∪Input␈α∩and␈α∪Output␈α∩in␈α∩MACLISP.␈α∪ First␈α∩are␈α∪the␈α∩basic
␈↓ ↓H␈↓functions␈α∞which␈α
read␈α∞and␈α
print.␈α∞ Some␈α
of␈α∞these␈α
deal␈α∞with␈α
S-expressions,␈α∞others␈α∞with␈α
characters.
␈↓ ↓H␈↓There␈αare␈α
also␈αfunctions␈αto␈α
do␈αconversions␈α
between␈αcharacters␈αand␈α
ASCII␈αcode.␈α
 Second␈αthere␈αis␈α
a
␈↓ ↓H␈↓collection␈α⊃of␈α⊂switches␈α⊃which␈α⊃can␈α⊂be␈α⊃turned␈α⊃on␈α⊂or␈α⊃off␈α⊃to␈α⊂control␈α⊃the␈α⊃source␈α⊂of␈α⊃input␈α⊃and␈α⊂the
␈↓ ↓H␈↓destinations␈α
of␈α
output.␈α
 Typically␈αthe␈α
input␈α
source␈α
is␈α
either␈αthe␈α
terminal␈α
or␈α
the␈α
currently␈αopened
␈↓ ↓H␈↓file.␈α
 Output␈α∞can␈α
go␈α∞to␈α
the␈α∞terminal,␈α
some␈α
subset␈α∞of␈α
the␈α∞currently␈α
opened␈α∞files,␈α
or␈α∞both.␈α
 Finally
␈↓ ↓H␈↓there are the functions that  open and close files.



␈↓ ↓H␈↓1.  ␈↓αBasic I/O operations.␈↓


␈↓ ↓H␈↓        We␈α⊃begin␈α∩with␈α⊃a␈α∩description␈α⊃of␈α∩the␈α⊃I/O␈α⊃operations␈α∩on␈α⊃the␈α∩user's␈α⊃terminal.␈α∩ The␈α⊃same
␈↓ ↓H␈↓operations can be used for doing "file" I/O as will be explained later.

␈↓ ↓H␈↓␈↓¬(READ)␈α␈↓reads␈αone␈αS-expression,␈αwhich␈αis␈αeither␈αa␈αlist␈α enclosed␈α in␈α matching␈αparentheses␈α or␈α an
␈↓ ↓H␈↓␈↓ αλatom␈α⊂ delimited␈α⊂ by␈α⊂a␈α⊃special␈α⊂character␈α⊂such␈α⊂as␈α⊂a␈α⊃space␈α⊂or␈α⊂a␈α⊂parenthesis.␈α⊃(A␈α⊂parenthesis
␈↓ ↓H␈↓␈↓ αλwould␈α
be␈α
saved␈α∞up␈α
and␈α
 used␈α
 on␈α∞the␈α
 next␈α
call␈α
to␈α∞␈↓¬READ.)␈α
␈↓␈α
␈↓¬READ␈α
␈↓returns␈α∞the␈α
S-expression
␈↓ ↓H␈↓␈↓ αλwhich␈αit␈αread,␈αconverting␈αit␈αfrom␈αthe␈αexternal␈αrepresentation␈αas␈αcharacters␈α to␈α LISP␈αinternal
␈↓ ↓H␈↓␈↓ αλform.␈α∞ When␈α
reading␈α∞from␈α
a␈α∞file,␈α
providing␈α∞an␈α
argument␈α∞to␈α
 ␈↓¬READ␈α∞␈↓␈α
causes␈α∞it␈α
to␈α∞return␈α
the
␈↓ ↓H␈↓␈↓ αλvalue␈α
of␈αthat␈α
argument␈αwhen␈α
the␈αend-of-file␈α
is␈αreached␈α
 (unless␈αyou␈α
have␈αspecified␈α
a␈αfancy
␈↓ ↓H␈↓␈↓ αλeof␈α
function).␈α
 If␈α
no␈α
argument␈αis␈α
provided,␈α
it␈α
closes␈α
the␈αfile␈α
and␈α
patiently␈α
waits␈α
for␈αinput␈α
from
␈↓ ↓H␈↓␈↓ αλthe terminal.

␈↓ ↓H␈↓␈↓¬(READCH) ␈↓ like read, but reads  in  one  character  and  returns it as a character object.

␈↓ ↓H␈↓␈↓¬(TYI)␈α∪␈↓reads␈α∪in␈α∩one␈α∪character␈α∪and␈α∩returns␈α∪ a␈α∪ number␈α∩ which␈α∪ is␈α∪ the␈α∩ASCII␈α∪code␈α∪for␈α∩the
␈↓ ↓H␈↓␈↓ αλcharacter.

␈↓ ↓H␈↓␈↓¬(PRINT x)␈α∞␈↓prints␈α
out␈α∞the␈α
S-expression␈α∞␈↓¬x␈α
␈↓in␈α∞a␈α
form␈α∞which␈α
is␈α∞readable␈α
by␈α∞ humans␈α∞ but␈α
 which
␈↓ ↓H␈↓␈↓ αλcould␈α also␈α be␈α read␈αback␈αinto␈αLISP␈αif␈αit␈αwere␈αprinted␈αto␈αa␈αfile␈αrather␈αthan␈αto␈α
the␈αterminal.
␈↓ ↓H␈↓␈↓ αλThe␈α∂expression␈α∂printed␈α∞out␈α∂is␈α∂preceded␈α∞by␈α∂a␈α∂newline␈α∞and␈α∂followed␈α∂by␈α∞a␈α∂space.␈α∂ If␈α∞special
␈↓ ↓H␈↓␈↓ αλcharacters␈α⊂or␈α∂strings␈α⊂of␈α⊂characters␈α∂are␈α⊂used␈α∂with␈α⊂other␈α⊂than␈α∂their␈α⊂ normal␈α⊂meanings,␈α∂ for
␈↓ ↓H␈↓␈↓ αλexample␈α
 if␈α a␈α
 parenthesis␈α
appears␈αin␈α
the␈α
pname␈αof␈α
an␈α
atom,␈αthey␈α
are␈α
preceded␈αand␈α
followed
␈↓ ↓H␈↓␈↓ αλby "|" so that the output  could  be  read back in.

␈↓ ↓H␈↓␈↓¬(PRIN1 x)␈α⊂␈↓is␈α⊂the␈α⊃same␈α⊂as␈α⊂␈↓¬(PRINT x)␈α⊃␈↓except␈α⊂that␈α⊂the␈α⊂leading␈α⊃newline␈α⊂and␈α⊂trailing␈α⊃space␈α⊂are
␈↓ ↓H␈↓␈↓ αλomitted.␈α
 ␈↓¬PRIN1␈α∞␈↓can␈α
be␈α∞used␈α
to␈α
 print␈α∞ multiple␈α
items␈α∞ on␈α
 a␈α
 line,␈α∞but␈α
spacing␈α∞between␈α
the
␈↓ ↓H␈↓␈↓ αλitems must be provided for explicitly, for example by evaluating ␈↓¬(TYO 40)␈↓.

␈↓ ↓H␈↓␈↓¬(PRINC x)␈α⊃␈↓is␈α⊃like␈α⊃␈↓¬(PRIN1 x)␈α⊃␈↓except␈α⊃that␈α∩special␈α⊃characters␈α⊃or␈α⊃strings␈α⊃of␈α⊃characters␈α∩are␈α⊃ not
␈↓ ↓H␈↓␈↓ αλsurrounded␈α∂by␈α∂"|".␈α∂ This␈α∞makes␈α∂the␈α∂output␈α∂more␈α∞pleasing␈α∂in␈α∂certain␈α∂situations,␈α∂however␈α∞it
␈↓ ↓H␈↓␈↓ αλcannot be  read  back  into LISP.

␈↓ ↓H␈↓␈↓¬(TERPRI) ␈↓types out a newline.
␈↓ ↓H␈↓␈↓ ¬}Section  IV␈↓ *17


␈↓ ↓H␈↓␈↓¬(TYO n)␈α
␈↓outputs␈αa␈α
character␈αwhose␈α
ASCII␈α
code␈αis␈α
given␈αby␈α
the␈α
number␈α␈↓¬n.␈α
␈↓␈α␈↓¬PRINC␈α
␈↓may␈α
also␈αbe
␈↓ ↓H␈↓␈↓ αλused to output character objects.

␈↓ ↓H␈↓        As␈α
an␈α∞example␈α
of␈α∞how␈α
some␈α∞of␈α
these␈α
reading␈α∞and␈α
printing␈α∞functions␈α
can␈α∞be␈α
used␈α∞here␈α
is
␈↓ ↓H␈↓part␈α∞of␈α∞a␈α∞program␈α∞that␈α∂is␈α∞used␈α∞as␈α∞a␈α∞self-documentation␈α∂feature␈α∞in␈α∞a␈α∞larger␈α∞ system.␈α∂ When␈α∞the
␈↓ ↓H␈↓system␈α∞is␈α
loaded␈α∞it␈α
prints␈α∞a␈α
message␈α∞telling␈α
the␈α∞user␈α
to␈α∞type␈α
␈↓¬(BBHELP)␈α∞␈↓for␈α∞information.␈α
 ␈↓¬BBHELP
␈↓ ↓H␈↓¬␈↓prints␈αout␈αa␈αmessage␈α
explaining␈αitself␈αthen␈αdoes␈αa␈α
␈↓¬READ.␈α␈↓␈αIf␈αthe␈αuser␈α
then␈αtypes␈αone␈αof␈α
the␈αtopic
␈↓ ↓H␈↓names␈αthe␈α
appropriate␈αmessage␈α
is␈αprinted␈αotherwise␈α
an␈αerror␈α
message␈αis␈α
printed.␈α  The␈α"|"s␈α
around
␈↓ ↓H␈↓each␈αline␈αof␈αthe␈αmessage␈αtell␈αLISP␈αthat␈αthis␈αis␈αreally␈αa␈αsingle␈αatom.␈α␈↓¬PRINC␈α␈↓prints␈αit␈αas␈αa␈αcharacter
␈↓ ↓H␈↓string omitting the "|" delimeters.  ␈↓¬PRINT ␈↓would retain the "|"s.

␈↓ ↓H␈↓¬            (DEFUN  BBHELP ()
␈↓ ↓H␈↓¬                (PROG (TOPIC)
␈↓ ↓H␈↓¬                    (BBMSG)
␈↓ ↓H␈↓¬                HELP
␈↓ ↓H␈↓¬                    (SETQ TOPIC (READ))
␈↓ ↓H␈↓¬                    (COND ((EQ TOPIC 'HELP) (BBHELPER))
␈↓ ↓H␈↓¬                          ((EQ TOPIC 'SYNTAX) (BBSYNHELPER))
␈↓ ↓H␈↓¬                          ((EQ TOPIC 'PUB) (BBPUBHELPER))
␈↓ ↓H␈↓¬                          ((EQ TOPIC 'LPT) (BBLPTHELPER))
␈↓ ↓H␈↓¬                          ((EQ TOPIC 'TXT) (BBTXTHELPER))
␈↓ ↓H␈↓¬                          ((EQ TOPIC 'EXIT) (RETURN 'Bye))
␈↓ ↓H␈↓¬                          (T (BBERRHELPER TOPIC)))
␈↓ ↓H␈↓¬                    (GO HELP)))


␈↓ ↓H␈↓¬            (DEFUN BBMSG ()
␈↓ ↓H␈↓¬                (TERPRI)
␈↓ ↓H␈↓¬                (PRINC '|The BB programs convert a list of atoms having |)
␈↓ ↓H␈↓¬                (TERPRI)
␈↓ ↓H␈↓¬                (PRINC '|EXPR FEXPR or VALUE properties to an external form.|)
␈↓ ↓H␈↓¬                (TERPRI)
␈↓ ↓H␈↓¬                (PRINC '|Type HELP to get a list of BBHELP topics|)
␈↓ ↓H␈↓¬                (TERPRI)
␈↓ ↓H␈↓¬                (PRINC '|Type EXIT to get out of BBHELP|)
␈↓ ↓H␈↓¬                (TERPRI))



␈↓ ↓H␈↓2.  ␈↓αFiles␈↓


␈↓ ↓H␈↓        I/O␈αin␈αLISP␈αconsists␈αof␈αcommunication␈αbetween␈αthe␈αLISP␈αenvironment␈αand␈αfiles␈αlocated␈αin
␈↓ ↓H␈↓the␈α∂external␈α∞world.␈α∂ LISP␈α∂refers␈α∞to␈α∂these␈α∞files␈α∂by␈α∂using␈α∞"file␈α∂objects,"␈α∞which␈α∂are␈α∂special␈α∞objects
␈↓ ↓H␈↓within␈α∞the␈α
LISP␈α∞environment␈α∞which␈α
serve␈α∞as␈α
representatives␈α∞of,␈α∞or␈α
symbols␈α∞for,␈α
the␈α∞files␈α∞in␈α
the
␈↓ ↓H␈↓external␈αworld.␈α Because␈αthere␈αis␈αa␈αone-to-one␈αcorrespondence␈αbetween␈αfiles␈αand␈αfile␈αobjects,␈α
it␈αis
␈↓ ↓H␈↓often convenient to confuse the two and call them both "file."

␈↓ ↓H␈↓        The␈α∂LISP␈α∂system␈α∂includes␈α∞functions␈α∂which␈α∂can␈α∂manipulate␈α∞files␈α∂in␈α∂various␈α∂ways:␈α∂ A␈α∞file
␈↓ ↓H␈↓may␈α∞be␈α∂"opened,"␈α∞that␈α∞is␈α∂a␈α∞file␈α∞object␈α∂may␈α∞be␈α∞created␈α∂and␈α∞associated␈α∞with␈α∂a␈α∞named␈α∞file␈α∂in␈α∞the
␈↓ ↓H␈↓external␈α∂world.␈α∂ A␈α∂file␈α∂may␈α∞be␈α∂"closed,"␈α∂that␈α∂is␈α∂the␈α∞association␈α∂between␈α∂the␈α∂file-object␈α∂and␈α∞the
␈↓ ↓H␈↓external␈αfile␈αmay␈αbe␈αbroken␈αand␈αthe␈αfile-object␈αdeleted.␈α The␈αfile-accessing␈αinformation␈αcontained
␈↓ ↓H␈↓in␈αa␈αfile-object␈αmay␈αbe␈αexamined␈αor␈αchanged;␈αfor␈αexample,␈αthe␈αline␈αlength␈αof␈αan␈αoutput␈α
file␈αmay
␈↓ ↓H␈↓18␈↓ ¬}Section  IV␈↓ H


␈↓ ↓H␈↓be␈α∂adjusted.␈α∂ The␈α∂characters␈α∂of␈α∂information␈α∂in␈α∂the␈α∂external␈α∂file␈α∂may␈α∂be␈α∂read␈α∂or␈α∂written.␈α∞ The
␈↓ ↓H␈↓attributes of the external file, such as its name, may be changed.


␈↓ ↓H␈↓αFile names and other information.

␈↓ ↓H␈↓        In␈α∂order␈α∂to␈α∂"open"␈α∂a␈α∂file,␈α∂the␈α∂external␈α⊂file␈α∂and␈α∂the␈α∂file␈α∂object␈α∂must␈α∂be␈α∂named␈α∂so␈α⊂that␈α∂a
␈↓ ↓H␈↓connection␈α⊃may␈α⊃be␈α⊃established␈α∩between␈α⊃them.␈α⊃ The␈α⊃problem␈α∩of␈α⊃naming␈α⊃file␈α⊃objects␈α∩is␈α⊃solved
␈↓ ↓H␈↓trivially␈α∂by␈α∂making␈α∂the␈α∂rule␈α∂that␈α∂whenever␈α∂a␈α∂file␈α∂object␈α∂is␈α∂created␈α∂its␈α∂name␈α∂is␈α∂decided␈α⊂by␈α∂the
␈↓ ↓H␈↓system␈αand␈αreturned␈αas␈αthe␈αvalue␈αof␈αthe␈αfunction␈αthat␈αcreated␈αit.␈α File␈αobjects␈αare␈αthen␈αreferred␈αto
␈↓ ↓H␈↓in␈α⊂the␈α⊂same␈α⊂way␈α⊃as␈α⊂any␈α⊂S-expression.␈α⊂ Note␈α⊃that␈α⊂the␈α⊂name␈α⊂of␈α⊂a␈α⊃file␈α⊂object␈α⊂does␈α⊂not␈α⊃have␈α⊂a
␈↓ ↓H␈↓printable␈α∂form,␈α∂so␈α∂that␈α∂if␈α⊂you␈α∂want␈α∂to␈α∂manipulate␈α∂the␈α⊂file␈α∂object␈α∂by␈α∂typing␈α∂from␈α⊂the␈α∂terminal
␈↓ ↓H␈↓(rather than from a program), you must keep the file object as the value of an atomic symbol.

␈↓ ↓H␈↓        The␈α
naming␈α
of␈α
files␈α
in␈α
the␈α
outside␈α
world␈α
is␈α
more␈α
difficult␈α
because␈α
MACLISP␈α
has␈αto␈α
operate
␈↓ ↓H␈↓with␈α⊂several␈α⊃different␈α⊂outside␈α⊃worlds,␈α⊂that␈α⊂is,␈α⊃under␈α⊂several␈α⊃different␈α⊂operating␈α⊃systems.␈α⊂ Two
␈↓ ↓H␈↓forms␈αfor␈αfile␈αnames␈αhave␈αbeen␈αdefined,␈αand␈αfunctions␈αare␈αprovided␈αto␈αmake␈αthe␈α
implementation-
␈↓ ↓H␈↓dependent␈α⊂translation␈α⊃from␈α⊂one␈α⊃form␈α⊂to␈α⊃the␈α⊂other.␈α⊂ The␈α⊃forms␈α⊂of␈α⊃a␈α⊂file␈α⊃name␈α⊂are␈α⊃called␈α⊂the
␈↓ ↓H␈↓namelist and the namestring.

␈↓ ↓H␈↓        The␈α⊂namestring␈α⊂is␈α⊂the␈α⊂implementation␈α⊂dependent␈α⊂form.␈α⊂ Namestrings␈α⊂are␈α⊃represented␈α⊂as
␈↓ ↓H␈↓LISP␈αcharacter␈α
strings,␈αhowever␈α
atomic␈αsymbols␈α
may␈αalso␈α
be␈αused,␈α
in␈αwhich␈α
case␈αthe␈α
pname␈αof␈α
the
␈↓ ↓H␈↓atomic␈αsymbol␈αis␈αused␈αas␈αthe␈αcharacter␈αstring.␈α The␈αcontents␈αof␈αa␈αnamestring␈αis␈αjust␈αa␈αsequence␈αof
␈↓ ↓H␈↓characters␈α⊂which␈α⊃have␈α⊂meaning␈α⊃to␈α⊂the␈α⊃user␈α⊂and␈α⊂to␈α⊃the␈α⊂function␈α⊃"namelist,"␈α⊂which␈α⊃converts␈α⊂a
␈↓ ↓H␈↓namestring␈α∂to␈α∂a␈α∂namelist.␈α∂ Namestrings␈α∂should␈α∂be␈α∂read␈α∂in␈α∂using␈α∂ ␈↓¬READSTRING␈α∂␈↓and␈α∂printed␈α∂out
␈↓ ↓H␈↓using ␈↓¬PRINC, ␈↓so that no quotes will appear around them.

␈↓ ↓H␈↓        A␈αnamelist␈αis␈αa␈αlist␈αwhose␈αcar␈αsomehow␈αspecifies␈αthe␈αdevice␈αand/or␈αdirectory␈αwhich␈αcontains
␈↓ ↓H␈↓the␈α
file,␈α
and␈α
whose␈α
␈↓↓cdr␈↓␈α
specifies␈α
the␈α
name␈α
of␈α
the␈α
file.␈α
 The␈α
exact␈α
way␈α
in␈α
which␈α
the␈α
␈↓↓car␈↓␈αspecifies␈α
the
␈↓ ↓H␈↓device/directory␈αis␈αimplementation-dependent.␈α It␈αshould␈αnot␈αbe␈αof␈αconcern␈αto␈αprograms.␈α The␈α␈↓↓cdr␈↓
␈↓ ↓H␈↓of␈αa␈αnamelist␈αis␈αa␈αlist␈αof␈αnames␈αwhich␈α
are␈αthe␈αcomponents␈αof␈αthe␈αfile␈αname␈αif␈αthe␈αoperating␈α
system
␈↓ ↓H␈↓uses␈α∩multi-component␈α∩file␈α∩names.␈α∩ Each␈α∩name␈α∩is␈α∩represented␈α∩as␈α∩an␈α∩atomic␈α∩symbol,␈α∪which␈α∩is
␈↓ ↓H␈↓"interned"␈α∂so␈α⊂that␈α∂it␈α∂may␈α⊂be␈α∂tested␈α∂using␈α⊂␈↓¬EQ.␈α∂␈↓␈α∂An␈α⊂additional␈α∂feature␈α∂of␈α⊂namelists␈α∂is␈α⊂the␈α∂"star
␈↓ ↓H␈↓convention,"␈α
by␈αwhich␈α
a␈αnamelist␈α
may␈αcontain␈α
unspecified␈αcomponents,␈α
which␈αare␈α
indicated␈αby␈α
the
␈↓ ↓H␈↓atom *.  The *'s are filled when needed using default values that the system keeps on hand.

␈↓ ↓H␈↓        The␈α∃conversion␈α⊗between␈α∃namlists␈α⊗and␈α∃namestrings␈α⊗are␈α∃carried␈α⊗out␈α∃by␈α⊗the␈α∃programs
␈↓ ↓H␈↓␈↓¬NAMELIST ␈↓and ␈↓¬NAMESTRING ␈↓as follows:

␈↓ ↓H␈↓␈↓¬NAMELIST␈α
␈↓␈α
(SUBR␈α
1␈α
arg)␈α
converts␈α
its␈α
argument␈α
to␈α
a␈α
namelist.␈α
 Omitted␈α
or␈α
*␈α
components␈α
in␈αthe
␈↓ ↓H␈↓␈↓ αλargument produce *'s in the result.
␈↓ ↓H␈↓␈↓¬NAMESTRING␈α∂␈↓␈α∞(SUBR␈α∂1␈α∞arg)␈α∂ converts␈α∞its␈α∂argument␈α∂from␈α∞a␈α∂namelist␈α∞to␈α∂a␈α∞namestring.␈α∂ It␈α∂is␈α∞the
␈↓ ↓H␈↓␈↓ αλopposite of namelist.

␈↓ ↓H␈↓        The␈α∩functions␈α∩␈↓¬STATUS␈α∩␈↓AND␈α∩␈↓¬SSTATUS␈α∩␈↓examine␈α∩and␈α∩set␈α∩the␈α∩status␈α∩of␈α∩system␈α∩variables.
␈↓ ↓H␈↓Some of these maintain defualts for file I/O.  They are:

␈↓ ↓H␈↓␈↓¬(STATUS␈α∩UDIR)␈↓␈α∩returns␈α∩the␈α∩the␈α∩name␈α∩of␈α∩the␈α∩user's␈α∩directory.␈α∩ For␈α∩example␈α∩␈↓¬(DSK␈α⊃|C.CLT|)␈↓.
␈↓ ↓H␈↓␈↓ αλ␈↓¬SSTATUS ␈↓does not apply.
␈↓ ↓H␈↓␈↓¬(STATUS␈α∂CRUNIT)␈↓␈α∂returns␈α∂the␈α∂current␈α∂(default)␈α∂device␈α∂and␈α∂directory.␈α∂ Is␈α∂initialized␈α∂to␈α∂␈↓¬(STATUS
␈↓ ↓H␈↓¬␈↓ αλUDIR)␈↓ in LISP at LOTS (not in MACLISP).
␈↓ ↓H␈↓␈↓ ¬}Section  IV␈↓ *19


␈↓ ↓H␈↓␈↓¬(SSTATUS␈α⊗CRUNIT␈α⊗dev␈α⊗dir)␈↓␈α⊗sets␈α⊗the␈α⊗defaults␈α⊗for␈α⊗device␈α⊗and␈α⊗directory␈α⊗to␈α⊗␈↓¬dev␈α↔␈↓and␈α⊗␈↓¬dir
␈↓ ↓H␈↓¬␈↓ αλ␈↓respectively.
␈↓ ↓H␈↓␈↓¬(STATUS␈α
CRFILE)␈↓␈α∞returns␈α
the␈α∞current␈α
(default)␈α∞file␈α
name␈α
and␈α∞extension.␈α
 It␈α∞returns␈α
␈↓¬NIL␈↓␈α∞if␈α
none
␈↓ ↓H␈↓␈↓ αλhas been set.
␈↓ ↓H␈↓␈↓¬(SSTATUS␈α∪CRFILE␈α∩nam␈α∪ext)␈↓␈α∩sets␈α∪the␈α∩defaults␈α∪for␈α∩file␈α∪name␈α∩and␈α∪extiosion␈α∩to␈α∪␈↓¬nam␈α∪␈↓and␈α∩␈↓¬ext
␈↓ ↓H␈↓¬␈↓ αλ␈↓respectively.

␈↓ ↓H␈↓        An␈α∞example␈α∂may␈α∞help␈α∂clarify␈α∞the␈α∞connection␈α∂between␈α∞namelists␈α∂and␈α∞namestrings.␈α∂  A␈α∞file
␈↓ ↓H␈↓PS:<C.CS206>GAME.LSP␈α
would␈αbe␈α
referred␈α
to␈αby␈α
the␈α
namestring␈α␈↓¬|PS:<C.CS206>GAME.LSP.3|
␈↓ ↓H␈↓¬␈↓or␈α∞by␈α∞the␈α∞namelist␈α∞␈↓¬((PS␈α
|C.CS206|)␈α∞GAME␈α∞LSP␈α∞/3)␈↓.␈α∞  If␈α
the␈α∞first␈α∞component␈α∞of␈α∞the␈α∞namelist␈α
is
␈↓ ↓H␈↓omitted␈α
then␈α
␈↓¬CRUNIT␈α␈↓is␈α
used.␈α
 In␈αsome␈α
cases␈α
 the␈αfile␈α
specification␈α
may␈αbe␈α
omitted␈α
enitrely.␈α The
␈↓ ↓H␈↓␈↓¬CRUNIT ␈↓and ␈↓¬CRFILE ␈↓are used to make up a specificaton.

␈↓ ↓H␈↓        Some␈αadditional␈αinformation␈α
about␈αfile␈αobjects␈α
has␈αbeen␈αcollected␈αhere.␈α
 It␈αis␈αin␈α
brief␈αform
␈↓ ↓H␈↓and␈α⊂will␈α⊂be␈α⊂elaborated␈α⊂in␈α⊂later␈α⊂sections.␈α⊂ There␈α∂is␈α⊂no␈α⊂way␈α⊂to␈α⊂input␈α⊂file␈α⊂objects␈α⊂to␈α⊂the␈α∂reader,
␈↓ ↓H␈↓because␈αthey␈αdo␈αnot␈αhave␈αpnames␈αor␈αanything␈αof␈αthat␈αsort,␈αbut␈αfor␈αconvenience␈αin␈αerror␈αmessages
␈↓ ↓H␈↓and␈αdebugging␈αthe␈αprinter␈αwill␈αprint␈αa␈αfile␈αobject␈αas␈αa␈αsharp␈αsign␈α(#),␈αfollowed␈αby␈αthe␈αnamestring
␈↓ ↓H␈↓of␈α
the␈α
external␈α
file␈α
to␈α
which␈αthe␈α
file␈α
object␈α
is␈α
attached.␈α
 #␈αis␈α
the␈α
character␈α
which␈α
is␈α
used␈αto␈α
indicate
␈↓ ↓H␈↓that␈αan␈αobject␈αof␈αunknown␈αtype␈αis␈αbeing␈αprinted.␈α The␈αinformation␈αcontained␈αwithin␈αa␈αfile␈αobject
␈↓ ↓H␈↓is here described briefly.

␈↓ ↓H␈↓␈↓¬NAMELIST ␈↓the namelist for the external file  of  which  the file object is a representative.
␈↓ ↓H␈↓␈↓¬EOFFN ␈↓a function which is applied when  the  end  of  an input file is reached.
␈↓ ↓H␈↓␈↓¬ENDPAGEFN␈α∞␈↓a␈α
function␈α∞which␈α
is␈α∞applied␈α
 when␈α∞ the␈α
 end␈α∞ of␈α
 a␈α∞ page␈α
 is␈α∞reached␈α
(on␈α∞an␈α
output
␈↓ ↓H␈↓␈↓ αλfile.)
␈↓ ↓H␈↓␈↓¬LINEL ␈↓the number of characters per  line  on  an  output file.
␈↓ ↓H␈↓␈↓¬Charpos ␈↓ the horizontal position on the line, where  0  is  the  left margin.
␈↓ ↓H␈↓␈↓¬CHRCT ␈↓ the number of character positions remaining on the current line of an output file,
␈↓ ↓H␈↓␈↓¬PAGEL␈α␈↓␈αthe␈αnumber␈αof␈αlines␈αper␈αpage.␈α ␈↓¬LINENUM␈α␈↓␈αthe␈αnumber␈αof␈αthe␈αcurrent␈αline,␈αwith␈α0␈αbeing␈αthe
␈↓ ↓H␈↓␈↓ αλtop of the page
␈↓ ↓H␈↓␈↓¬PAGENUM ␈↓  the number of the current page, with the first page being 0.
␈↓ ↓H␈↓␈↓¬FILEPOS␈α⊂␈↓␈α⊂the␈α⊂position␈α⊂within␈α⊂ the␈α∂ file␈α⊂ of␈α⊂ the␈α⊂ character␈α⊂currently␈α⊂  being␈α⊂  accessed.␈α∂   (Not
␈↓ ↓H␈↓␈↓ αλnecessarily meaningful for all kinds of files.)

␈↓ ↓H␈↓Note that as a special case ␈↓¬T ␈↓is considered to be a file object which represents the terminal.


␈↓ ↓H␈↓αOpening and Closing Files

␈↓ ↓H␈↓        In␈α∂order␈α∂to␈α∂do␈α∂file␈α∂input/output␈α⊂operations␈α∂files␈α∂must␈α∂be␈α∂opened␈α∂and␈α∂closed.␈α⊂ The␈α∂LISP
␈↓ ↓H␈↓primitives ␈↓¬OPEN ␈↓and ␈↓¬CLOSE ␈↓carry out these tasks.

␈↓ ↓H␈↓␈↓¬OPEN␈α∞␈↓␈α∞(LSUBR␈α∞0␈α∞to␈α∞2␈α∞args)␈α∞ ␈↓¬(OPEN␈α
<file>␈α∞<mode>)␈↓␈α∞opens␈α∞a␈α∞file␈α∞and␈α∞returns␈α∞a␈α
corresponding
␈↓ ↓H␈↓␈↓ αλfile␈α
object.␈α The␈α
␈↓¬<file>␈α
␈↓defaults␈αto␈α
the␈αcurrent␈α
default␈α
file.␈α The␈α
␈↓¬<mode>␈α␈↓defaults␈α
to␈α
␈↓¬NIL.␈α␈↓
␈↓ ↓H␈↓␈↓ αλIf␈α␈↓¬<file>␈α␈↓is␈αa␈αnamelist␈αor␈αnamestring,␈αa␈αnew␈αfile␈αobject␈αis␈αcreated.␈α If␈α␈↓¬<file>␈α␈↓is␈αa␈αfile␈αobject
␈↓ ↓H␈↓␈↓ αλalready,␈α
it␈α
is␈α
closed␈α
and␈α
re-opened␈α
in␈αthe␈α
specified␈α
mode;␈α
its␈α
former␈α
mode␈α
serve␈α
as␈αthe␈α
default
␈↓ ↓H␈↓␈↓ αλfor␈αthe␈α
␈↓¬<mode>.␈αThe␈α␈↓␈↓¬<mode>␈α
␈↓can␈αbe␈αone␈α
of␈αthe␈αfollowing:␈α
␈↓¬IN,␈α␈↓␈↓¬OUT,␈α␈↓␈↓¬APPEND␈α
␈↓␈αfor␈α
input␈αfile,
␈↓ ↓H␈↓␈↓ αλoutput file (creates a new file) and output file (append to existing file), respectively.

␈↓ ↓H␈↓[Remark:␈α
␈↓¬<mode>␈α
␈↓can␈α
also␈αbe␈α
a␈α
list␈α
specifing␈α
attributes␈αin␈α
addition␈α
to␈α
"direction".␈α
 These␈αdefault
␈↓ ↓H␈↓␈↓ αλto the right thing for ordinary input/output in LISP.]
␈↓ ↓H␈↓20␈↓ ¬}Section  IV␈↓ H


␈↓ ↓H␈↓␈↓¬CLOSE␈α∞␈↓␈α∞(SUBR␈α∞1␈α∞arg)␈α∞ ␈↓¬(CLOSE␈α∞ x)␈↓,␈α∞where␈α∞␈↓¬x␈α∞␈↓is␈α∞a␈α∞file,␈α∞closes␈α∞␈↓¬x␈α∞␈↓and␈α∞returns␈α∞␈↓¬T.␈α∞␈↓␈α∞If␈α∞␈↓¬x␈α∂␈↓is␈α∞already
␈↓ ↓H␈↓␈↓ αλclosed␈α∞nothing␈α∞happens,␈α∞ otherwise␈α
 the␈α∞ file␈α∞ system␈α∞ is␈α∞directed␈α
to␈α∞return␈α∞␈↓¬x␈α∞␈↓to␈α∞a␈α
quiescent
␈↓ ↓H␈↓␈↓ αλstate.


␈↓ ↓H␈↓αSpecifying the Source or Destination for I/O.

␈↓ ↓H␈↓        When␈α
an␈α
I/O␈α
function␈α
is␈α∞called,␈α
the␈α
source␈α
(file)␈α
from␈α
which␈α∞it␈α
is␈α
to␈α
take␈α
its␈α
input␈α∞or␈α
the
␈↓ ↓H␈↓destinations␈α(files)␈αon␈αwhich␈αit␈αis␈αto␈αput␈αits␈αoutput␈αmay␈αbe␈αspecified␈αdirectly␈αas␈αan␈αargument␈αto␈α
the
␈↓ ↓H␈↓function,␈α
or␈αthey␈α
may␈αbe␈α
specified␈α
by␈αdefault.␈α
 The␈αdefault␈α
input␈αsource␈α
and␈α
output␈αdestinations
␈↓ ↓H␈↓are␈α∂specified␈α∂by␈α∞several␈α∂system␈α∂variables,␈α∂which␈α∞may␈α∂be␈α∂setq'ed␈α∞or␈α∂lambda-bound␈α∂by␈α∂the␈α∞user.
␈↓ ↓H␈↓They␈α
are␈α
described␈α
below.␈α
 ␈↓¬INFILE␈α
is␈α∞␈↓the␈α
default␈α
input␈α
source,␈α
if␈α
the␈α∞switch␈α
␈↓¬↑Q␈α
␈↓is␈α
␈↓¬T.␈α
␈↓␈α
If␈α∞␈↓¬↑Q␈α
␈↓is
␈↓ ↓H␈↓␈↓¬NIL␈α∩␈↓the␈α∩terminal␈α∩is␈α∩used␈α∩as␈α∩the␈α∩default␈α⊃input␈α∩source.␈α∩ ␈↓¬OUTFILES␈α∩␈↓is␈α∩a␈α∩list␈α∩of␈α∩default␈α⊃output
␈↓ ↓H␈↓destinations.␈α
 Output␈α
is␈α
sent␈α∞to␈α
all␈α
of␈α
these␈α
files␈α∞if␈α
the␈α
␈↓¬↑R␈α
␈↓switch␈α
is␈α∞␈↓¬T.␈α
␈↓␈α
Output␈α
also␈α
goes␈α∞to␈α
the
␈↓ ↓H␈↓terminal␈α
unless␈α
the␈α
␈↓¬↑W␈α
␈↓switch␈α
is␈α
␈↓¬T.␈α
␈↓␈α
Note␈α
that␈α
if␈α
the␈α
value␈α
of␈α
␈↓¬INFILE␈α
␈↓is␈α
␈↓¬T␈α
␈↓(␈↓¬OUTFILES␈α
␈↓is␈α
␈↓¬NIL␈↓␈α
or
␈↓ ↓H␈↓␈↓¬(T)␈↓) it means the terminal, any anything else must be a file object.

␈↓ ↓H␈↓␈↓¬INFILE␈α␈↓␈α(VARIABLE)␈α The␈αvalue␈αof␈α␈↓¬INFILE␈α␈↓is␈αa␈αfile␈αobject␈αwhich␈αis␈αthe␈α default␈α input␈αsource
␈↓ ↓H␈↓␈↓ αλif␈α∩␈↓¬↑Q␈α∩␈↓is␈α∪non-NIL.␈α∩ ␈↓¬INFILE␈α∩␈↓can␈α∪also␈α∩be␈α∩␈↓¬T␈α∪␈↓which␈α∩specifies␈α∩that␈α∪input␈α∩will␈α∩be␈α∪from␈α∩the
␈↓ ↓H␈↓␈↓ αλterminal even if ␈↓¬↑Q ␈↓is non-NIL.   The initial value of ␈↓¬INFILE ␈↓is ␈↓¬T. ␈↓
␈↓ ↓H␈↓␈↓¬↑Q␈α␈↓␈α(SWITCH)␈α If␈αthe␈αvalue␈αof␈α␈↓¬↑Q␈α␈↓is␈αnon-NIL,␈αthe␈αdefault␈αinput␈αsource␈αis␈αthe␈αvalue␈αof␈αthe␈αatom
␈↓ ↓H␈↓␈↓ αλ␈↓¬INFILE. ␈↓ If ␈↓¬↑Q ␈↓is ␈↓¬NIL, ␈↓the default input source is ␈↓¬NIL, ␈↓i.e. the terminal.
␈↓ ↓H␈↓␈↓¬INSTACK␈α␈↓␈α(VARIABLE)␈α The␈αvalue␈αof␈α␈↓¬INSTACK␈α␈↓is␈αa␈αlist␈αof␈αpushed-down␈αvalues␈α of␈α␈↓¬INFILE.␈α␈↓␈αIt
␈↓ ↓H␈↓␈↓ αλis managed by the program ␈↓¬INPUSH. ␈↓ The initial value is ␈↓¬NIL␈↓.
␈↓ ↓H␈↓␈↓¬OUTFILES␈α⊂␈↓␈α⊂(VARIABLE)␈α⊂ The␈α⊂ value␈α⊂of␈α⊂␈↓¬OUTFILES␈α⊂␈↓is␈α⊂a␈α⊂list␈α⊂of␈α⊂file␈α⊂objects␈α⊂which␈α⊂are␈α∂output
␈↓ ↓H␈↓␈↓ αλdestinations␈α⊃if␈α⊃␈↓¬↑R␈α⊃␈↓is␈α⊃not␈α⊃␈↓¬NIL␈↓.␈α⊃ Elements␈α⊃of␈α⊃the␈α⊃list␈α⊃␈↓¬OUTFILES␈α⊃␈↓may␈α⊃be␈α⊃either␈α⊃file␈α⊃objects
␈↓ ↓H␈↓␈↓ αλcreated␈α∞by␈α
␈↓¬OPEN,␈α∞␈↓or␈α∞␈↓¬NIL␈↓␈α
 meaning␈α∞output␈α
 to␈α∞ the␈α∞ terminal.␈α
 Note␈α∞that␈α
output␈α∞goes␈α∞to␈α
the
␈↓ ↓H␈↓␈↓ αλterminal anyway if ␈↓¬↑W ␈↓is ␈↓¬NIL␈↓, so it is possible to get  double  characters this way.
␈↓ ↓H␈↓␈↓¬↑R␈α␈↓␈α(SWITCH)␈α If␈α the␈α value␈α of␈α␈↓¬↑R␈α␈↓is␈αnon-NIL,␈αthe␈αdefault␈αoutput␈αdestinations␈αinclude␈αthe␈αfiles
␈↓ ↓H␈↓␈↓ αλin the list which is the value of the atom ␈↓¬OUTFILES. ␈↓
␈↓ ↓H␈↓␈↓¬↑W␈α
␈↓␈α∞(SWITCH)␈α
 If␈α∞the␈α
value␈α∞of␈α
␈↓¬↑W␈α
␈↓is␈α∞non-NIL,␈α
the␈α∞default␈α
output␈α∞destinations␈α
do␈α∞not␈α
 include
␈↓ ↓H␈↓␈↓ αλthe terminal.  (Unless ␈↓¬↑R ␈↓is on and ␈↓¬T ␈↓is a member of the outfiles list.)
␈↓ ↓H␈↓␈↓¬FILEPOS␈α∞␈↓␈α∞ (LSUBR␈α
1␈α∞or␈α∞2␈α∞args)␈α
␈↓¬(FILEPOS␈α∞x)␈↓,␈α∞where␈α
␈↓¬x␈α∞␈↓is␈α∞a␈α∞file␈α
object␈α∞open␈α∞for␈α∞input,␈α
returns
␈↓ ↓H␈↓␈↓ αλthe␈α
current␈α character␈α
 position␈α within␈α
 the␈α file␈α
as␈α
a␈αfixnum.␈α
 The␈αbeginning␈α
of␈αthe␈α
file␈αis␈α
0.
␈↓ ↓H␈↓␈↓ αλ␈↓¬(FILEPOS␈α∂x␈α∞n)␈↓,␈α∂where␈α∞␈↓¬x␈α∂␈↓is␈α∞a␈α∂file␈α∞object␈α∂open␈α∞for␈α∂input␈α∞and␈α∂␈↓¬n␈α∞␈↓is␈α∂a␈α∂non-negative␈α∞fixnum,
␈↓ ↓H␈↓␈↓ αλresets␈α∂the␈α∂character␈α∂position␈α∞of␈α∂the␈α∂file␈α∂to␈α∂position␈α∞specified␈α∂by␈α∂␈↓¬n.␈α∂␈↓␈α∞It␈α∂is␈α∂an␈α∂error␈α∂if␈α∞ this
␈↓ ↓H␈↓␈↓ αλposition␈α∞ does␈α∞not␈α
 lie␈α∞ within␈α∞ the␈α
 file␈α∞ or␈α∞ if␈α
 the␈α∞ file␈α∞ is␈α
 not␈α∞ randomly␈α∞accessible.␈α∞ ␈↓¬N␈α
␈↓is
␈↓ ↓H␈↓␈↓ αλreturned.




␈↓ ↓H␈↓αHandling End of File

␈↓ ↓H␈↓        Calls␈α∞to␈α∞the␈α∞input␈α
functions␈α∞␈↓¬READ,␈α∞␈↓␈↓¬READCH,␈α∞␈↓␈↓¬READSTRING,␈α
␈↓and␈α∞␈↓¬TYI␈α∞␈↓␈α∞specify␈α∞an␈α
argument
␈↓ ↓H␈↓called␈α
the␈α
␈↓¬eofval.␈α
␈↓␈α∞If␈α
this␈α
argument␈α
is␈α
omitted␈α∞␈↓¬NIL␈↓␈α
is␈α
assumed.␈α
 If␈α
the␈α∞end␈α
of␈α
the␈α
input␈α∞file␈α
is
␈↓ ↓H␈↓reached␈α⊂during␈α⊂the␈α⊂execution␈α⊂of␈α⊂the␈α⊃function,␈α⊂the␈α⊂␈↓¬eofval␈α⊂␈↓argument␈α⊂is␈α⊂used␈α⊂by␈α⊃the␈α⊂following
␈↓ ↓H␈↓procedure:

␈↓ ↓H␈↓        Each␈αfile␈αobject␈αhas␈αan␈α
end-of-file␈αhandler,␈αits␈α␈↓¬eoffn.␈α␈↓␈α
When␈αan␈αend␈αof␈αfile␈α
occurs␈αwhile
␈↓ ↓H␈↓␈↓ ¬}Section  IV␈↓ *21


␈↓ ↓H␈↓input␈α
is␈α
being␈α
taken␈α
from␈α
this␈α
file,␈α
the␈α
␈↓¬eoffn␈α
is␈α
␈↓examined.␈α
(Eof␈α
on␈α
the␈α
terminal␈α∞cannot␈α
occur.)
␈↓ ↓H␈↓If␈αthe␈α␈↓¬eoffn␈α␈↓is␈α␈↓¬NIL␈↓,␈αthen␈αthe␈αfollowing␈αdefault␈αaction␈αis␈αtaken:␈α If␈αeofval␈αon␈αthe␈αcall␈αto␈α␈↓¬READ␈α␈↓was
␈↓ ↓H␈↓not␈αsupplied,␈αthen␈αthe␈αinput␈αfile␈αis␈αclosed␈αand␈α␈↓¬READ␈α␈↓continues␈αtaking␈αcharacters␈αfrom␈αa␈αnew␈αinput
␈↓ ↓H␈↓file␈α∞popped␈α∞off␈α∂the␈α∞input␈α∞stack.␈α∞ If␈α∂the␈α∞input␈α∞stack␈α∂is␈α∞empty,␈α∞␈↓¬(SETQ␈α∞↑Q␈α∂NIL)␈↓␈α∞is␈α∞done␈α∂and␈α∞read
␈↓ ↓H␈↓continues␈αreading␈αfrom␈αthe␈αterminal.␈α If␈αan␈α␈↓¬eofval␈α␈↓was␈αsupplied␈αon␈αthe␈αcall␈αto␈α␈↓¬READ,␈α␈↓then␈α␈↓¬READ
␈↓ ↓H␈↓¬␈↓immediately returns it.  The input file is not closed.

␈↓ ↓H␈↓        This␈αis␈αnot␈αstrictly␈αtrue␈αin␈αthe␈αcase␈αwhere␈αthe␈αinput␈αfunction␈αis␈α␈↓¬READ␈α␈↓or␈α␈↓¬READSTRING␈α␈↓and␈αit
␈↓ ↓H␈↓is␈αin␈αthe␈αmiddle␈αof␈αan␈αobject.␈α In␈αthis␈αcase,␈αrather␈αthan␈αallowing␈αthe␈αobject␈αto␈αcross␈αfiles,␈αa␈α␈↓¬fail-
␈↓ ↓H␈↓¬act␈α
␈↓error␈α
occurs.␈α
 The␈α
argument␈α
passed␈α
to␈α
the␈α
user␈α
interrupt␈α
service␈α
function␈α
is␈α
the␈α
list␈α␈↓¬(READ-
␈↓ ↓H␈↓¬EOF)␈↓.␈α∞ If␈α
the␈α∞interrupt␈α
service␈α∞function␈α∞returns␈α
an␈α∞atom␈α
(such␈α∞as␈α∞␈↓¬NIL␈↓),␈α
␈↓¬READ␈α∞␈↓␈↓¬errs␈α
␈↓out;␈α∞but␈α∞if␈α
it
␈↓ ↓H␈↓returns␈αa␈αlist,␈α␈↓¬READ␈α␈↓goes␈αon␈αreading␈αfrom␈αthe␈αnew␈αinput␈αsource␈αas␈αif␈αthere␈αhad␈αnot␈αbeen␈αany␈αend-
␈↓ ↓H␈↓of-file.

␈↓ ↓H␈↓        If␈α
the␈α␈↓¬eoffn␈α
␈↓for␈α
the␈αinput␈α
file␈α
is␈αnot␈α
␈↓¬NIL␈↓,␈α
then␈αit␈α
is␈α
a␈αfunction␈α
and␈α
it␈αis␈α
applied␈α
with␈αtwo
␈↓ ↓H␈↓arguments.␈α The␈αfirst␈αargument␈αis␈αthe␈αfile␈αobject␈αthat␈αeof'ed.␈α The␈αsecond␈αargument␈αis␈αthe␈α␈↓¬eofval
␈↓ ↓H␈↓¬␈↓on␈αthe␈αcall␈αto␈α␈↓¬READ,␈α␈↓or,␈αif␈αan␈α␈↓¬eofval␈α␈↓was␈αnot␈αsupplied,␈α␈↓¬NIL␈↓.␈α If␈αthe␈α␈↓¬eoffn␈α␈↓returns␈α␈↓¬NIL␈↓,␈αthe␈αfile␈αis
␈↓ ↓H␈↓closed␈α⊃and␈α⊃reading␈α⊂continues␈α⊃from␈α⊃the␈α⊃input␈α⊂source␈α⊃popped␈α⊃off␈α⊂the␈α⊃input␈α⊃stack.␈α⊃ The␈α⊂above
␈↓ ↓H␈↓prohibition␈α⊂of␈α⊂objects␈α⊃crossing␈α⊂␈↓¬eofs␈α⊂␈↓applies.␈α⊃ If␈α⊂the␈α⊂␈↓¬eoffn␈α⊃␈↓returns␈α⊂␈↓¬T␈↓,␈α⊂reading␈α⊃continues␈α⊂from
␈↓ ↓H␈↓whatever␈α∞input␈α∂source␈α∞was␈α∞made␈α∂the␈α∞current␈α∂default␈α∞one␈α∞by␈α∂the␈α∞␈↓¬eoffn.␈α∞␈↓␈α∂If␈α∞the␈α∂␈↓¬eoffn␈α∞␈↓returns
␈↓ ↓H␈↓something␈αother␈αthan␈α␈↓¬T␈↓␈αor␈α␈↓¬NIL␈↓,␈αthen␈α␈↓¬READ␈α␈↓immediately␈αreturns␈αwhatever␈αthe␈α␈↓¬eoffn␈α␈↓returned,␈αand
␈↓ ↓H␈↓the file is not closed unless the ␈↓¬eoffn ␈↓closes it.

␈↓ ↓H␈↓␈↓¬EOFFN␈α⊃␈↓␈α⊃ (LSUBR␈α⊂1␈α⊃OR␈α⊃2␈α⊂ARGS)␈α⊃␈↓¬(EOFFN␈α⊃x)␈↓,␈α⊃where␈α⊂␈↓¬x␈α⊃␈↓is␈α⊃an␈α⊂input␈α⊃file,␈α⊃gets␈α⊃␈↓¬x␈↓'s␈α⊂end-of-file
␈↓ ↓H␈↓␈↓ αλfunction.␈α  The␈α end-of-file␈αfunction␈αis␈αcalled␈αif␈αthe␈αend␈αof␈αthe␈αfile␈αis␈αreached␈α
during␈αinput.
␈↓ ↓H␈↓␈↓ αλ␈↓¬(EOFFN␈αNIL)␈↓␈αgets␈αthe␈αdefault␈αend-of-file␈αfunction.␈α ␈↓¬(EOFFN␈αx␈αf)␈↓␈αsets␈α␈↓¬x␈↓'s␈αend-of-file␈αfunction
␈↓ ↓H␈↓␈↓ αλto␈α∂␈↓¬f.␈α∂␈↓␈α∂␈↓¬(EOFFN␈α⊂NIL␈α∂f)␈↓␈α∂sets␈α∂the␈α⊂default␈α∂end-of-file␈α∂function␈α∂to␈α∂␈↓¬f.␈α⊂␈↓␈α∂␈↓¬f␈α∂␈↓may␈α∂be␈α⊂␈↓¬NIL␈↓,␈α∂which
␈↓ ↓H␈↓␈↓ αλmeans that no end-of-file function is  to  be used.



␈↓ ↓H␈↓3.  ␈↓αBasic I/O Operations Revisited.␈↓

␈↓ ↓H␈↓␈↓¬READ␈α∂␈↓␈α∞(LSUBR␈α∂0␈α∞TO␈α∂2␈α∞ARGS)␈α∂␈↓¬(READ)␈α∞␈↓reads␈α∂an␈α∞S-expression␈α∂from␈α∞the␈α∂default␈α∂input␈α∞source.
␈↓ ↓H␈↓␈↓ αλ␈↓¬(READ␈α∞f)␈↓,␈α∞where␈α∞␈↓¬f␈α∞␈↓is␈α∞a␈α∞file␈α∞or␈α∞␈↓¬NIL␈↓␈α∞meaning␈α∞the␈α∞terminal,␈α∞reads␈α∞an␈α∞S-expression␈α∞from␈α∞␈↓¬f.␈α
␈↓
␈↓ ↓H␈↓␈↓ αλDuring␈α⊃the␈α⊃reading,␈α⊃␈↓¬INFILE␈α⊃␈↓and␈α⊃␈↓¬↑Q␈α⊃␈↓are␈α⊃bound␈α⊃so␈α⊃that␈α⊃evaluation␈α⊃of␈α⊃␈↓¬(READ)␈↓␈α⊃within␈α⊂ a
␈↓ ↓H␈↓␈↓ αλmacro-character␈α function␈αwill␈αread␈αfrom␈αthe␈αcorrect␈αinputp≡source.␈α ␈↓¬(READ␈α x)␈↓,␈α where␈α ␈↓¬x␈α␈↓␈αis
␈↓ ↓H␈↓␈↓ αλnot␈α∞ a␈α∞file␈α∂and␈α∞not␈α∞␈↓¬NIL␈↓,␈α∂passes␈α∞␈↓¬x␈α∞␈↓as␈α∞an␈α∂argument␈α∞to␈α∞the␈α∂end-of-file␈α∞function␈α∞of␈α∂the␈α∞input
␈↓ ↓H␈↓␈↓ αλsource␈α∞ if␈α∞ the␈α∞end␈α∂ of␈α∞ the␈α∞ file␈α∞is␈α∂reached.␈α∞ Usually␈α∞this␈α∞means␈α∂that␈α∞read␈α∞will␈α∞return␈α∂␈↓¬x␈α∞␈↓if
␈↓ ↓H␈↓␈↓ αλthere␈αare␈αno␈αmore␈αS-expressions␈αin␈αthe␈αfile.␈α ␈↓¬(READ␈αT)␈↓␈αsuppresses␈αthe␈αcalling␈αof␈αthe␈α end-of-
␈↓ ↓H␈↓␈↓ αλfile␈α function␈α if␈αthe␈αend␈αof␈αthe␈αfile␈αis␈αreached.␈α Instead,␈αread␈αjust␈αreturns␈αT.␈α ␈↓¬(READ␈α x␈α f)␈↓
␈↓ ↓H␈↓␈↓ αλor ␈↓¬(READ f x)␈↓ specifies the end-of-file value ␈↓¬x ␈↓and selects the input source ␈↓¬f. ␈↓
␈↓ ↓H␈↓␈↓¬READCH␈α⊂␈↓␈α⊂(LSUBR␈α⊂0␈α⊂TO␈α⊂2␈α⊂ARGS)␈α⊂␈↓¬READCH␈α⊂␈↓reads␈α⊂in␈α⊂one␈α⊂character␈α⊂and␈α⊂ returns␈α⊂ a␈α∂ character
␈↓ ↓H␈↓␈↓ αλobject.  The arguments are the same as for read.
␈↓ ↓H␈↓␈↓¬READLINE␈α⊂␈↓␈α⊂(LSUBR␈α⊂0␈α⊂TO␈α⊂2␈α⊂ARGS)␈α⊂␈↓¬READLINE␈α⊂␈↓␈α⊂reads␈α⊂ in␈α⊂ a␈α⊂ line␈α⊂ of␈α⊂ text,␈α⊂ strips␈α⊃ off␈α⊂ the
␈↓ ↓H␈↓␈↓ αλnewline␈α
character␈α
or␈αcharacters␈α
at␈α
the␈αend,␈α
and␈α
returns␈αit␈α
in␈α
the␈αform␈α
of␈α
a␈α
character␈αstring.
␈↓ ↓H␈↓␈↓ αλThe␈α∞arguments␈α
are␈α∞the␈α
same␈α∞as␈α∞for␈α
␈↓¬READ.␈α∞␈↓␈α
The␈α∞main␈α∞use␈α
for␈α∞␈↓¬READLINE␈α
␈↓is␈α∞reading␈α∞in␈α
file
␈↓ ↓H␈↓␈↓ αλnames typed by the  user at his terminal in response to a question.
␈↓ ↓H␈↓␈↓¬TYI␈α∞␈↓␈α∞ (LSUBR␈α∞0␈α∞TO␈α∞2␈α∞ARGS)␈α∞␈↓¬TYI␈α∂␈↓␈α∞inputs␈α∞one␈α∞character␈α∞and␈α∞returns␈α∞a␈α∞fixnum␈α∞which␈α∂is␈α∞the
␈↓ ↓H␈↓␈↓ αλascii code for that character.  The arguments are the same as for ␈↓¬READ. ␈↓
␈↓ ↓H␈↓22␈↓ ¬}Section  IV␈↓ H


␈↓ ↓H␈↓␈↓¬TYIPEEK␈α∂␈↓␈α⊂(LSUBR␈α∂0␈α∂OR␈α⊂1␈α∂ARG)␈α⊂␈↓¬(TYIPEEK)␈↓␈α∂is␈α∂like␈α⊂␈↓¬(TYI)␈α∂␈↓except␈α∂that␈α⊂the␈α∂character␈α⊂is␈α∂ not
␈↓ ↓H␈↓␈↓ αλeaten;␈α
it␈α
 is␈α
 still␈α
in␈α
the␈α
input␈α
stream␈α
where␈α
the␈α
next␈α
call␈α
to␈α
an␈α
input␈α
operation␈α
will␈α
find␈α
it.
␈↓ ↓H␈↓␈↓ αλThus␈α
␈↓¬(EQ␈α
(TYIPEEK)␈α∞(TYI))␈↓␈α
is␈α
␈↓¬T.␈α
␈↓␈α∞ If␈α
 the␈α
end␈α
 of␈α∞ the␈α
 file␈α
is␈α
reached,␈α∞␈↓¬TYIPEEK␈α
␈↓returns
␈↓ ↓H␈↓␈↓ αλ3,␈α∞(the␈α∂ascii␈α∞code␈α∂for␈α∞"end␈α∂of␈α∞text.")␈α∂The␈α∞end␈α∂of␈α∞file␈α∂function␈α∞is␈α∂not␈α∞called.␈α∂ ␈↓¬(TYIPEEK␈α∞n)␈↓,
␈↓ ↓H␈↓␈↓ αλwhere␈α
 ␈↓¬n␈α
␈↓␈α
is␈α a␈α
 fixnum␈α
 <␈α
 200␈α octal,␈α
 skips␈α
 over␈α
characters␈αof␈α
input␈α
until␈α
one␈α
is␈αreached
␈↓ ↓H␈↓␈↓ αλwith␈α⊃an␈α⊂ascii␈α⊃code␈α⊃of␈α⊂␈↓¬n.␈α⊃␈↓␈α⊂That␈α⊃character␈α⊃is␈α⊂not␈α⊃eaten.␈α⊂ ␈↓¬(TYIPEEK␈α⊃ n)␈↓,␈α⊃ where␈α⊂␈↓¬n␈α⊃␈↓␈α⊃is␈α⊂ a
␈↓ ↓H␈↓␈↓ αλfixnum␈α >␈α 1000␈αoctal,␈αskips␈αover␈αcharacters␈αof␈αinput␈αuntil␈αone␈αis␈αreached␈αwhose␈αsyntax␈α bits
␈↓ ↓H␈↓␈↓ αλfrom␈α∞the␈α∞readtable,␈α∞logically␈α∞anded␈α∞with␈α∞(lsh␈α∞n␈α∞-9.),␈α∞are␈α∞nonzero.␈α∞ ␈↓¬(TYIPEEK␈α∞t)␈↓␈α∂skips␈α∞over
␈↓ ↓H␈↓␈↓ αλcharacters␈α⊃of␈α⊃input␈α⊃until␈α⊂the␈α⊃beginning␈α⊃of␈α⊃an␈α⊂ S-expression␈α⊃ is␈α⊃reached.␈α⊃ Splicing␈α⊂macro
␈↓ ↓H␈↓␈↓ αλcharacters,␈α∃such␈α∃as␈α∃";"␈α∃comments,␈α∃are␈α∃not␈α∃considered␈α∃to␈α∃begin␈α∃an␈α∃object.␈α∃ If␈α∃ one␈α∃ is
␈↓ ↓H␈↓␈↓ αλencountered,␈α its␈α
associated␈αfunction␈α
is␈αcalled␈α
as␈αusual␈α
(so␈αthat␈α
the␈αtext␈α
of␈αthe␈α
comment␈α can
␈↓ ↓H␈↓␈↓ αλbe  gobbled  up  or  whatever)  and ␈↓¬TYIPEEK ␈↓continues scanning characters.
␈↓ ↓H␈↓␈↓¬PRIN1␈α␈↓␈α(LSUBR␈α1␈αOR␈α2␈αARGS)␈α␈↓¬(PRIN1␈α x)␈↓␈α outputs␈α␈↓¬x␈α␈↓␈αto␈αthe␈αcurrent␈αoutput␈α
destination(s),␈αin
␈↓ ↓H␈↓␈↓ αλa␈α∪form␈α∪suitable␈α∪for␈α∩reading␈α∪back␈α∪in.␈α∪ ␈↓¬(PRIN1␈α∩x␈α∪ f)␈↓␈α∪outputs␈α∪␈↓¬x␈α∩␈↓on␈α∪the␈α∪file␈α∪␈↓¬f,␈α∪␈↓or␈α∩the
␈↓ ↓H␈↓␈↓ αλterminal  if  ␈↓¬f ␈↓ is ␈↓¬NIL␈↓.
␈↓ ↓H␈↓␈↓¬PRINT␈α␈↓␈α(LSUBR␈α1␈αOR␈α2␈αARGS)␈α␈↓¬PRINT␈α␈↓␈αis␈α like␈α␈↓¬PRIN1␈α␈↓␈αexcept␈α that␈α the␈αoutput␈αis␈αpreceded␈αby␈αa
␈↓ ↓H␈↓␈↓ αλnewline␈α
and␈α
followed␈α
by␈α∞a␈α
space.␈α
 This␈α
 is␈α
 the␈α∞ output␈α
 function␈α
most␈α
often␈α∞used.␈α
 ␈↓¬(PRINT
␈↓ ↓H␈↓¬␈↓ αλx)␈↓␈αprints␈α
␈↓¬x␈α␈↓to␈αthe␈α
default␈αoutput␈αdestinations.␈α
 ␈↓¬(PRINT␈α x␈α f)␈↓␈α
 prints␈α␈↓¬x␈α␈↓to␈α
the␈αfile␈α␈↓¬f,␈α
␈↓or␈αto
␈↓ ↓H␈↓␈↓ αλthe terminal if ␈↓¬f ␈↓is ␈↓¬NIL␈↓.
␈↓ ↓H␈↓␈↓¬PRINC␈α␈↓␈α(LSUBR␈α1␈αOR␈α2␈αARGS)␈α␈↓¬PRINC␈α␈↓is␈α like␈α␈↓¬PRIN1␈α␈↓␈αexcept␈α that␈α special␈α characters␈α are␈α not
␈↓ ↓H␈↓␈↓ αλslashified␈α∃and␈α∃strings␈α⊗are␈α∃ not␈α∃quoted.␈α⊗ ␈↓¬(PRINC␈α∃x)␈↓␈α∃outputs␈α⊗␈↓¬x␈α∃␈↓to␈α∃ the␈α⊗current␈α∃output
␈↓ ↓H␈↓␈↓ αλdestination(s).  ␈↓¬(PRINC x f)␈↓ outputs ␈↓¬x ␈↓to the file ␈↓¬f, ␈↓or the terminal if ␈↓¬f ␈↓is ␈↓¬NIL␈↓.
␈↓ ↓H␈↓␈↓¬TYO␈α␈↓␈α (LSUBR␈α1␈αOR␈α2␈αARGS)␈α␈↓¬(TYO␈α␈↓␈αn)␈↓¬␈α␈↓␈αtypes␈α out␈α the␈α character␈αwhose␈αascii␈αcode␈αis␈α␈↓¬n␈α␈↓on␈αthe
␈↓ ↓H␈↓␈↓ αλcurrent␈α
output␈α
destination(s).␈α
 ␈↓¬(TYO␈α
n␈α∞f)␈↓␈α
types␈α
out␈α
the␈α
character␈α∞whoe␈α
ascii␈α
code␈α
 is␈α
 ␈↓¬n␈α∞␈↓␈α
on
␈↓ ↓H␈↓␈↓ αλthe file  ␈↓¬f ␈↓ or  on  the terminal if ␈↓¬f ␈↓is ␈↓¬NIL␈↓.  ␈↓¬TYO ␈↓returns its first argument.
␈↓ ↓H␈↓␈↓¬TERPRI␈α␈↓␈α (LSUBR␈α0␈αOR␈α1␈αARG)␈α␈↓¬(TERPRI)␈α␈↓sends␈αa␈αnewline␈αto␈αthe␈αcurrent␈αoutput␈αdestination(s).
␈↓ ↓H␈↓␈↓ αλ␈↓¬(TERPRI␈α⊂x)␈↓␈α⊂sends␈α⊂a␈α⊃newline␈α⊂to␈α⊂␈↓¬x,␈α⊂␈↓where␈α⊃␈↓¬x␈α⊂␈↓may␈α⊂be␈α⊂an␈α⊃output␈α⊂file␈α⊂or␈α⊂␈↓¬NIL␈↓␈α⊃meaning␈α⊂the
␈↓ ↓H␈↓␈↓ αλterminal.
␈↓ ↓H␈↓␈↓¬INPUSH␈α⊂␈↓␈α⊂ (SUBR␈α∂1␈α⊂ARG)␈α⊂␈↓¬(INPUSH␈α∂x)␈↓,␈α⊂where␈α⊂␈↓¬x␈α∂␈↓is␈α⊂a␈α⊂file␈α∂object␈α⊂open␈α⊂for␈α∂ input␈α⊂ or␈α⊂ ␈↓¬NIL␈↓␈α∂ to
␈↓ ↓H␈↓␈↓ αλspecify␈α the␈α terminal,␈α pushes␈αthe␈αcurrent␈αinput␈α
source␈αonto␈αthe␈αinput␈αstack␈αand␈αselects␈α
␈↓¬x␈α␈↓as
␈↓ ↓H␈↓␈↓ αλthe␈αcurrent␈αinput␈αsource.␈α␈↓¬(INPUSH␈α0)␈↓␈αjust␈αreturns␈α␈↓¬INFILE.␈α␈↓␈α␈↓¬(INPUSH␈α-1)␈↓␈αpops␈αa␈αnew␈αinput
␈↓ ↓H␈↓␈↓ αλsource␈αoff␈α
of␈αthe␈α
input␈αstack:␈α
In␈αthe␈αcase␈α
that␈α␈↓¬INSTACK␈α
␈↓is␈α␈↓¬NIL␈↓,␈α
i.e.␈αempty.␈α
 In␈αthis␈αcase␈α
␈↓¬INPUSH
␈↓ ↓H␈↓¬␈↓ αλ␈↓ leaves␈α
␈↓¬INSTACK␈α
␈↓␈↓¬NIL␈↓␈α
and␈α makes␈α
␈↓¬INFILE␈α
␈↓␈↓¬T,␈α
␈↓which␈αmeans␈α
the␈α
terminal.␈α
 ␈↓¬(INPUSH␈α
-n)␈↓␈αdoes
␈↓ ↓H␈↓␈↓ αλ␈↓¬(INPUSH␈α⊂-1)␈↓␈α⊃␈↓¬n␈α⊂␈↓times.␈α⊂ ␈↓¬(INPUSH␈α⊃ 1)␈↓␈α⊂ does␈α⊂ ␈↓¬(INPUSH␈α⊃ (INPUSH␈α⊂ 0))␈↓,␈α⊂␈↓¬(INPUSH␈α⊃+n)␈↓␈α⊂does
␈↓ ↓H␈↓␈↓ αλthat␈α␈↓¬n␈α␈↓times.␈α The␈αvalue␈αof␈α␈↓¬INPUSH␈α␈↓is␈α the␈α newly␈α selected␈α input␈α source.␈α  If␈α␈↓¬INPUSH␈α␈↓causes
␈↓ ↓H␈↓␈↓ αλ␈↓¬INFILE ␈↓to be set to ␈↓¬T, ␈↓␈↓¬↑Q ␈↓is set to ␈↓¬NIL␈↓ since the terminal has become the input source.
␈↓ ↓H␈↓␈↓ ¬}Section  IV␈↓ *23


␈↓ ↓H␈↓4.  ␈↓αI/O Examples.␈↓



␈↓ ↓H␈↓αFile selection

␈↓ ↓H␈↓        ␈↓¬TTYMSG␈α␈↓is␈αan␈αexample␈αof␈αhow␈αthe␈αfile␈αselection␈αworks.␈α ␈↓¬TTYMSG␈α␈↓will␈αwrite␈αthe␈αmessage␈αgiven
␈↓ ↓H␈↓to␈αit␈αas␈αan␈αargument␈αon␈αthe␈αterminal␈αno␈αmatter␈αwhat␈αthe␈αvalue␈αof␈αthe␈αI/O␈αswitches␈αare␈αwhen␈αit␈αis
␈↓ ↓H␈↓called.␈α It␈αsaves␈αthe␈αcurrent␈αswitches,␈αdisables␈αoutput␈αto␈αa␈αfile␈αand␈αenables␈αoutput␈αto␈α
the␈αterminal,
␈↓ ↓H␈↓␈↓¬PRINT␈↓s the message then restores the switches.

␈↓ ↓H␈↓¬        (DEFPROP TTYMSG
␈↓ ↓H␈↓¬         (LAMBDA(MSG)
␈↓ ↓H␈↓¬          (PROG (CR CW) (SETQ CR ↑R CW ↑W)
␈↓ ↓H␈↓¬                        (SETQ ↑R NIL ↑W NIL)
␈↓ ↓H␈↓¬                        (PRINT MSG) 
␈↓ ↓H␈↓¬                        (TERPRI)
␈↓ ↓H␈↓¬                        (SETQ ↑R CR ↑W CW)))
␈↓ ↓H␈↓¬        EXPR)


␈↓ ↓H␈↓αElementary examples of file manipulation.

␈↓ ↓H␈↓¬(defun readloop (fileob)   for reading to end-of-file
␈↓ ↓H␈↓¬  (prog (form if)
␈↓ ↓H␈↓¬        (setq if (open fileob 'in))
␈↓ ↓H␈↓¬  loop  (setq form (read if))
␈↓ ↓H␈↓¬        (print form)
␈↓ ↓H␈↓¬        (cond ((null form) (return if)))
␈↓ ↓H␈↓¬        (go loop)))
␈↓ ↓H␈↓¬READLOOP 

␈↓ ↓H␈↓¬(setq of (open '(tmp 1) 'out))          ;;; open file called TMP.1  for output
␈↓ ↓H␈↓¬ #FILE-OUT-|DSK:DSK:<C.CLT>TMP.1.25|-64774      ;;; makes a new version
␈↓ ↓H␈↓¬(print '|hello there| of)               ;;; write a messge 
␈↓ ↓H␈↓¬ T 
␈↓ ↓H␈↓¬(close of)
␈↓ ↓H␈↓¬ T 
␈↓ ↓H␈↓¬(readloop of)                           ;;; old version is not contained 
␈↓ ↓H␈↓¬|hello there|                           ;;; in new version
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬#FILE-IN-|DSK:<C.CLT>TMP.1|-64774 

␈↓ ↓H␈↓¬of
␈↓ ↓H␈↓¬#FILE-IN-|DSK:<C.CLT>TMP.1|-64774       ;;;NB the file object has been changed!

␈↓ ↓H␈↓¬(setq of (open of 'out))
␈↓ ↓H␈↓¬#FILE-OUT-|DSK:DSK:<C.CLT>TMP.1.26|-64774 
␈↓ ↓H␈↓¬(close of)
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬(readloop of)
␈↓ ↓H␈↓¬NIL                                     ;;; nothing sent, nothing there
␈↓ ↓H␈↓¬#FILE-IN-|DSK:<C.CLT>TMP.1|-64774 

␈↓ ↓H␈↓¬(setq of (open '(tmp 1) 'out))          ;;; start again
␈↓ ↓H␈↓¬#FILE-OUT-|PS:<C.CLT>TMP.1.27|-64774 
␈↓ ↓H␈↓¬(print '|me again| of)
␈↓ ↓H␈↓24␈↓ ¬}Section  IV␈↓ H


␈↓ ↓H␈↓¬ T
␈↓ ↓H␈↓¬(close of)
␈↓ ↓H␈↓¬ T
␈↓ ↓H␈↓¬(readloop of)
␈↓ ↓H␈↓¬|me again| 
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬#FILE-IN-|DSK:<C.CLT>TMP.1|-64774 

␈↓ ↓H␈↓¬(setq af (open of 'append))
␈↓ ↓H␈↓¬#FILE-OUT-|PS:<C.CLT>TMP.1.28|-64774 
␈↓ ↓H␈↓¬(print '|whats new| af)
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬(close af)
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬(readloop of)           
␈↓ ↓H␈↓¬|whats new| 
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬#FILE-IN-|DSK:<C.CLT>TMP.1|-64774 

␈↓ ↓H␈↓¬;;; In append mode the original contents of the file should still be there.
␈↓ ↓H␈↓¬;;; Currently APPEND mode just makes a new version.  In Tenex-20 you can
␈↓ ↓H␈↓¬;;; append the two versions yourself using the monitor command APPEND.
␈↓ ↓H␈↓¬;;; Hopefully this bug will be fixed soon.

␈↓ ↓H␈↓¬;;; In order to get output to a file must give file object to output
␈↓ ↓H␈↓¬;;; program directly or turnon ↑R switch and put the intended file object(s)
␈↓ ↓H␈↓¬;;; on the $OUTFILES list.

␈↓ ↓H␈↓¬(setq of (open of 'out)
␈↓ ↓H␈↓¬#FILE-OUT-|PS:<C.CLT>TMP.1.29|-64774 
␈↓ ↓H␈↓¬((lambda(↑r outfiles)(print '|setting ↑r and outfiles?|))t (list af))   
␈↓ ↓H␈↓¬|setting only ↑r and outfiles?| 
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬(close af)
␈↓ ↓H␈↓¬T 
␈↓ ↓H␈↓¬(readloop of)
␈↓ ↓H␈↓¬|setting ↑r and outfiles?|      
␈↓ ↓H␈↓¬NIL 
␈↓ ↓H␈↓¬#FILE-IN-|DSK:<C.CLT>TMP.1|-64774 
␈↓ ↓H␈↓␈↓ ¬}Section  IV␈↓ *25


␈↓ ↓H␈↓αThe programs ␈↓¬PPOUT, ␈↓α␈↓¬DSKIN ␈↓αand ␈↓¬QREAD␈↓α.

␈↓ ↓H␈↓        Here is the code for the programs ␈↓¬PPOUT, ␈↓␈↓¬DKSIN, ␈↓and ␈↓¬QREAD ␈↓ described in Section II.

␈↓ ↓H␈↓¬(DEFUN PPOUT FEXPR (F) 
␈↓ ↓H␈↓¬       ((LAMBDA (LOADGRINDER OCRU OCRF OFILE ↑W ↑R) 
␈↓ ↓H␈↓¬                (PROG (FNS) 
␈↓ ↓H␈↓¬                      (SETQ OUTFILES (LIST OFILE)) ;;;files to write to
␈↓ ↓H␈↓¬                      (SETQ FNS (CDR F))
␈↓ ↓H␈↓¬                 LOOP (COND ((NOT (NULL FNS))
␈↓ ↓H␈↓¬                             (APPLY 'GRINDEF (LIST (CAR FNS)))
␈↓ ↓H␈↓¬                             (SETQ FNS (CDR FNS))
␈↓ ↓H␈↓¬                             (GO LOOP)))
␈↓ ↓H␈↓¬                      (CLOSE OFILE)
␈↓ ↓H␈↓¬                      (APPLY 'CRUNIT OCRU)               ;;;restore file status
␈↓ ↓H␈↓¬                      (APPLY 'SSTATUS (CONS 'CRFILE OCRF))
␈↓ ↓H␈↓¬                      (SETQ OUTFILES NIL)
␈↓ ↓H␈↓¬                      (RETURN OFILE)))
␈↓ ↓H␈↓¬        (COND ((NOT (GET 'GRINDEF 'FSUBR))   ;;;load grinder if not there
␈↓ ↓H␈↓¬               (APPLY 'LOAD
␈↓ ↓H␈↓¬                      (LIST (GET 'GRINDEF 'AUTOLOAD)))))
␈↓ ↓H␈↓¬        (STATUS CRUNIT)         ;;;save current file status
␈↓ ↓H␈↓¬        (STATUS CRFILE)
␈↓ ↓H␈↓¬        (OPEN (MAKE-FILE-SPECS (CAR F)) 'OUT)
␈↓ ↓H␈↓¬        T                                       ;;;turnoff tty
␈↓ ↓H␈↓¬        T))                                     ;;;turnon dsk

␈↓ ↓H␈↓¬(DEFUN QREAD FEXPR (F) 
␈↓ ↓H␈↓¬       ((LAMBDA (OCRU OCRF IFILE) 
␈↓ ↓H␈↓¬                (PROG (FORM) 
␈↓ ↓H␈↓¬                 LOOP (SETQ FORM (READ IFILE))
␈↓ ↓H␈↓¬                      (COND (FORM (EVAL FORM) (GO LOOP)))
␈↓ ↓H␈↓¬                      (APPLY 'CRUNIT OCRU)
␈↓ ↓H␈↓¬                      (APPLY 'SSTATUS (CONS 'CRFILE OCRF))
␈↓ ↓H␈↓¬                      (INPUSH -1)
␈↓ ↓H␈↓¬                      (RETURN IFILE)))
␈↓ ↓H␈↓¬        (STATUS CRUNIT)
␈↓ ↓H␈↓¬        (STATUS CRFILE)
␈↓ ↓H␈↓¬        (INPUSH (OPEN (MAKE-FILE-SPECS F) 'IN))))

␈↓ ↓H␈↓¬(DEFUN DSKIN FEXPR (F) 
␈↓ ↓H␈↓¬       ((LAMBDA (OCRU OCRF IFILE) 
␈↓ ↓H␈↓¬                (PROG (FORM) 
␈↓ ↓H␈↓¬                 LOOP (SETQ FORM (READ IFILE))
␈↓ ↓H␈↓¬                      (COND (FORM (PRINT (EVAL FORM)) (GO LOOP)))
␈↓ ↓H␈↓¬                      (TERPRI)
␈↓ ↓H␈↓¬                      (APPLY 'CRUNIT OCRU)
␈↓ ↓H␈↓¬                      (APPLY 'SSTATUS
␈↓ ↓H␈↓¬                             (CONS 'CRFILE OCRF))
␈↓ ↓H␈↓¬                      (INPUSH -1)
␈↓ ↓H␈↓¬                      (RETURN IFILE)))
␈↓ ↓H␈↓¬        (STATUS CRUNIT)
␈↓ ↓H␈↓¬        (STATUS CRFILE)
␈↓ ↓H␈↓¬        (INPUSH(OPEN (MAKE-FILE-SPECS F) 'IN))))

␈↓ ↓H␈↓¬(DEFUN MAKE-FILE-SPECS (F) (COND ((ATOM (CAR F)) (CONS (CRUNIT) F)) (T F)))
␈↓ ↓H␈↓␈↓ εH␈↓ ?i


␈↓ ↓H␈↓α␈↓ ¬uAppendix A

␈↓ ↓H␈↓α␈↓ ∧aMACLISP functions and features.


␈↓ ↓H␈↓α␈↓ β"TOPS-20/TENEX MacLISP 1862 Functions and Other Features

␈↓ ↓H␈↓        This a machine-generated, alphabetized listing of all functions and features in MACLISP.

␈↓ ↓H␈↓ε                        User SUBRs:

␈↓ ↓H␈↓ε                            *-READ-EVAL-PRINT      COPYSYMBOL             NCONS
␈↓ ↓H␈↓ε                            *BREAK                 COS                    NOINTERRUPT
␈↓ ↓H␈↓ε                            *DIF                   CXR                    NORET
␈↓ ↓H␈↓ε                            *NOPOINT               DEFAULTF               NOT
␈↓ ↓H␈↓ε                            *QUO                   DELETEF                NOUUO
␈↓ ↓H␈↓ε                            *READ                  DEPOSIT                NRECONC
␈↓ ↓H␈↓ε                            *READCH                DISPLACE               NREVERSE
␈↓ ↓H␈↓ε                            *RSET                  EQ                     NTH
␈↓ ↓H␈↓ε                            *THROW                 EQUAL                  NTHCDR
␈↓ ↓H␈↓ε                            *TYI                   ERRFRAME               NULL
␈↓ ↓H␈↓ε                            +TYO                   EVALFRAME              NUMBERP
␈↓ ↓H␈↓ε                            1+                     EXAMINE                ODDP
␈↓ ↓H␈↓ε                            1+$                    EXP                    OUT
␈↓ ↓H␈↓ε                            1-                     EXPLODE                PLIST
␈↓ ↓H␈↓ε                            1-$                    EXPLODEC               PLUSP
␈↓ ↓H␈↓ε                            <                      EXPLODEN               PNGET
␈↓ ↓H␈↓ε                            =                      EXPT                   PNPUT
␈↓ ↓H␈↓ε                            >                      FASLP                  PROBEF
␈↓ ↓H␈↓ε                            ABS                    FILEP                  PUTPROP
␈↓ ↓H␈↓ε                            ADD1                   FILLARRAY              QMARK
␈↓ ↓H␈↓ε                            ALLOC                  FIX                    READ-*-EVAL-PRINT
␈↓ ↓H␈↓ε                            ALPHALESSP             FIXNUM-IDENTITY        READ-EVAL-*-PRINT
␈↓ ↓H␈↓ε                            ARG                    FIXP                   READ-EVAL-PRINT-*
␈↓ ↓H␈↓ε                            ARRAYDIMS              FLATC                  READLIST
␈↓ ↓H␈↓ε                            ASCII                  FLATSIZE               RECLAIM
␈↓ ↓H␈↓ε                            ASSOC                  FLOAT                  REMAINDER
␈↓ ↓H␈↓ε                            ASSQ                   FLOATP                 REMOB
␈↓ ↓H␈↓ε                            ATAN                   FLONUM-IDENTITY        REMPROP
␈↓ ↓H␈↓ε                            ATOM                   FORCE-OUTPUT           RENAMEF
␈↓ ↓H␈↓ε                            BIGP                   FRETRY                 RETURN
␈↓ ↓H␈↓ε                            BOUNDP                 FRETURN                REVERSE
␈↓ ↓H␈↓ε                            CAAAAR                 FSC                    ROT
␈↓ ↓H␈↓ε                            CAAADR                 GC                     RPLACA
␈↓ ↓H␈↓ε                            CAAAR                  GCD                    RPLACD
␈↓ ↓H␈↓ε                            CAADAR                 GET                    RPLACX
␈↓ ↓H␈↓ε                            CAADDR                 GETCHAR                RUNTIME
␈↓ ↓H␈↓ε                            CAADR                  GETCHARN               SAMEPNAMEP
␈↓ ↓H␈↓ε                            CAAR                   GETL                   SASSOC
␈↓ ↓H␈↓ε                            CADAAR                 HAIPART                SASSQ
␈↓ ↓H␈↓ε                            CADADR                 HAULONG                SET
␈↓ ↓H␈↓ε                            CADAR                  HUNKP                  SETARG
␈↓ ↓H␈↓ε                            CADDAR                 HUNKSIZE               SETPLIST
␈↓ ↓H␈↓ε                            CADDDR                 IFIX                   SETSYNTAX
␈↓ ↓H␈↓ε                            CADDR                  IMPLODE                SHORTNAMESTRING
␈↓ ↓H␈↓ε                            CADR                   IN                     SIN
␈↓ ↓H␈↓ε                            CAR                    INPUSH                 SLEEP
␈↓ ↓H␈↓ε                            CDAAAR                 INTERN                 SQRT
␈↓ ↓H␈↓ε                            CDAADR                 LAST                   SUB1
␈↓ ↓H␈↓ε                            CDAAR                  LENGTH                 SUBLIS
␈↓ ↓H␈↓ε                            CDADAR                 LENGTHF                SUBR
␈↓ ↓H␈↓ε                            CDADDR                 LISTIFY                SUBST
␈↓ ↓H␈↓ε                            CDADR                  LOAD                   SXHASH
␈↓ ↓H␈↓ε                            CDAR                   LOG                    SYMBOLP
␈↓ ↓H␈↓ε                            CDDAAR                 LSH                    SYMEVAL
␈↓ ↓H␈↓ε                            CDDADR                 MAKHUNK                SYSP
␈↓ ↓H␈↓ii␈↓ ¬pAppendix  A␈↓ H


␈↓ ↓H␈↓ε                            CDDAR                  MAKNAM                 TIME
␈↓ ↓H␈↓ε                            CDDDAR                 MAKNUM                 TRUENAME
␈↓ ↓H␈↓ε                            CDDDDR                 MAKUNBOUND             TYPEP
␈↓ ↓H␈↓ε                            CDDDR                  MEMBER                 VALUE-CELL-LOCATION
␈↓ ↓H␈↓ε                            CDDR                   MEMQ                   XCONS
␈↓ ↓H␈↓ε                            CDR                    MERGEF                 ZEROP
␈↓ ↓H␈↓ε                            CLEAR-INPUT            MINUS                  \
␈↓ ↓H␈↓ε                            CLEAR-OUTPUT           MINUSP                 \\
␈↓ ↓H␈↓ε                            CLOSE                  MUNKAM                 ↑
␈↓ ↓H␈↓ε                            CNAMEF                 NAMELIST               ↑$
␈↓ ↓H␈↓ε                            CONS                   NAMESTRING             ↑G


␈↓ ↓H␈↓ε                        User FSUBRs:

␈↓ ↓H␈↓ε                            *CATCH            CRUNIT            INCLUDE           STORE
␈↓ ↓H␈↓ε                            *FUNCTION         DECLARE           LSUBRCALL         SUBRCALL
␈↓ ↓H␈↓ε                            AND               DEFPROP           OR                THROW
␈↓ ↓H␈↓ε                            ARRAY             DEFUN             POP               UAPPEND
␈↓ ↓H␈↓ε                            ARRAYCALL         DO                PROG              UCLOSE
␈↓ ↓H␈↓ε                            BREAK             ERR               PROGV             UFILE
␈↓ ↓H␈↓ε                            CASEQ             ERRSET            PUSH              UKILL
␈↓ ↓H␈↓ε                            CATCH             EVAL-WHEN         QUOTE             UNWIND-PROTECT
␈↓ ↓H␈↓ε                            CATCH-BARRIER     FASLOAD           SETQ              UPROBE
␈↓ ↓H␈↓ε                            CATCHALL          FUNCTION          SIGNP             UREAD
␈↓ ↓H␈↓ε                            COMMENT           GCTWA             SSTATUS           UWRITE
␈↓ ↓H␈↓ε                            COND              GO                STATUS


␈↓ ↓H␈↓ε                        User LSUBRs:

␈↓ ↓H␈↓ε                            *             BOOLE         GREATERP      MAPLIST       RANDOM
␈↓ ↓H␈↓ε                            *$            CHARPOS       HUNK          MAX           READ
␈↓ ↓H␈↓ε                            *ARRAY        DELETE        LESSP         MIN           READCH
␈↓ ↓H␈↓ε                            *REARRAY      DELQ          LINEL         NCONC         READLINE
␈↓ ↓H␈↓ε                            +             DIFFERENCE    LINENUM       OPEN          RUBOUT
␈↓ ↓H␈↓ε                            +$            ENDPAGEFN     LIST          PAGEL         SUSPEND
␈↓ ↓H␈↓ε                            -             EOFFN         LIST*         PAGENUM       TERPRI
␈↓ ↓H␈↓ε                            -$            ERROR         LISTARRAY     PLUS          TIMES
␈↓ ↓H␈↓ε                            /             ERRPRINT      LISTEN        PRIN1         TYI
␈↓ ↓H␈↓ε                            /$            EVAL          MAP           PRINC         TYIPEEK
␈↓ ↓H␈↓ε                            APPEND        EVALHOOK      MAPATOMS      PRINT         TYO
␈↓ ↓H␈↓ε                            APPLY         FILEPOS       MAPC          PROG2         VALRET
␈↓ ↓H␈↓ε                            ARGS          FUNCALL       MAPCAN        PROGN
␈↓ ↓H␈↓ε                            BAKLIST       GENSYM        MAPCAR        QUIT
␈↓ ↓H␈↓ε                            BAKTRACE      GETSP         MAPCON        QUOTIENT



␈↓ ↓H␈↓ε                        STATUS options (* = can use with SSTATUS too):

␈↓ ↓H␈↓ε                            * +                * FLUSH              PDL                TABSIZE
␈↓ ↓H␈↓ε                            * ABBREVIATE         FXPDL            * PDLMAX           * TERPRI
␈↓ ↓H␈↓ε                              ARRAY            * GCMAX              PDLNAMES         * TOPLEVEL
␈↓ ↓H␈↓ε                              BPSH             * GCMIN              PDLROOOM         * TTY
␈↓ ↓H␈↓ε                              BPSL             * GCSIZE             PDLSIZE          * TTYCONS
␈↓ ↓H␈↓ε                            * BREAK            * GCTIME           * PUNT             * TTYINT
␈↓ ↓H␈↓ε                            * CHTRAN             HOMEDIR            PURSIZE          * TTYREAD
␈↓ ↓H␈↓ε                            * CRFIL              HSNAM              PURSPACENAMES    * TTYSCAN
␈↓ ↓H␈↓ε                            * CRUNIT             JCL              * RANDOM             TTYTYPE
␈↓ ↓H␈↓ε                              DATE               JNAME              SEGLOG             UDIR
␈↓ ↓H␈↓ε                              DAYTIME            JNUMBER            SPCNAMES           UNAME
␈↓ ↓H␈↓ε                            * DIVOV            * LINMODE            SPCSIZE          * UREAD
␈↓ ↓H␈↓ε                              DOW                LISPVERSION        SPDL               USERI
␈↓ ↓H␈↓ε                            * EVALHOOK         * LOSEF              SSTATUS          * UUOLINKS
␈↓ ↓H␈↓ε                              FASLOAD          * MACRO              STATUS           * UWRITE
␈↓ ↓H␈↓ε                            * FEATURE            MEMFREE            SUBSYS             XUNAM
␈↓ ↓H␈↓ε                              FILEMODE           NEWLINE          * SYNTAX           * ←
␈↓ ↓H␈↓ε                              FLPDL            * NOFEATURE          SYSTEM
␈↓ ↓H␈↓␈↓ ¬pAppendix  A␈↓ -iii




␈↓ ↓H␈↓ε                        Initial arrays:

␈↓ ↓H␈↓ε                            OBARRAY      READTABLE


␈↓ ↓H␈↓ε                        Initial User AUTOLOAD properties:

␈↓ ↓H␈↓ε                            NAME OF ATOM                   INITIAL VALUE

␈↓ ↓H␈↓ε                            CGOL                           ((DSK MACLISP) CGOL FASL)
␈↓ ↓H␈↓ε                            CGOLREAD                       ((DSK MACLISP) CGOL FASL)
␈↓ ↓H␈↓ε                            DEFMACRO                       ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            DEFMACRO-DISPLACE              ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            DEFUN&                         ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            DEFUN&-ERROR                   ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            DESETQ                         ((DSK MACLISP) LET FASL)
␈↓ ↓H␈↓ε                            DUMPARRAYS                     ((DSK MACLISP) DUMPARRAYS FASL)
␈↓ ↓H␈↓ε                            EDIT                           ((DSK MACLISP) EDIT FASL)
␈↓ ↓H␈↓ε                            FORMAT                         ((DSK MACLISP) FORMAT FASL)
␈↓ ↓H␈↓ε                            GETMIDASOP                     ((DSK MACLISP) GETMIDASOP FASL)
␈↓ ↓H␈↓ε                            GRIND                          ((DSK MACLISP) GRIND FASL)
␈↓ ↓H␈↓ε                            GRIND0                         ((DSK MACLISP) GRIND FASL)
␈↓ ↓H␈↓ε                            GRINDEF                        ((DSK MACLISP) GRINDEF FASL)
␈↓ ↓H␈↓ε                            LAP                            ((DSK MACLISP) LAP FASL)
␈↓ ↓H␈↓ε                            LAP-A-LIST                     ((DSK MACLISP) LAP FASL)
␈↓ ↓H␈↓ε                            LET                            ((DSK MACLISP) LET FASL)
␈↓ ↓H␈↓ε                            LET*                           ((DSK MACLISP) LET FASL)
␈↓ ↓H␈↓ε                            LOADARRAYS                     ((DSK MACLISP) DUMPARRAYS FASL)
␈↓ ↓H␈↓ε                            MACRO                          ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            MACROEXPAND                    ((DSK MACLISP) DEFMAX FASL)
␈↓ ↓H␈↓ε                            MACROEXPAND-1                  ((DSK MACLISP) DEFMAX FASL)
␈↓ ↓H␈↓ε                            MACROEXPANDED                  ((DSK MACLISP) DEFMAX FASL)
␈↓ ↓H␈↓ε                            MACROFETCH                     ((DSK MACLISP) DEFMAX FASL)
␈↓ ↓H␈↓ε                            MACROMEMO                      ((DSK MACLISP) DEFMAX FASL)
␈↓ ↓H␈↓ε                            READMACROINVERSE               ((DSK MACLISP) GRINDEF FASL)
␈↓ ↓H␈↓ε                            SORT                           ((DSK MACLISP) SORT FASL)
␈↓ ↓H␈↓ε                            SORTCAR                        ((DSK MACLISP) SORT FASL)
␈↓ ↓H␈↓ε                            SPRINTER                       ((DSK MACLISP) GRINDEF FASL)
␈↓ ↓H␈↓ε                            TRACE                          ((DSK MACLISP) TRACE FASL)


␈↓ ↓H␈↓ε                        LAP and FASLOAD functions:

␈↓ ↓H␈↓ε                            *APPEND         *NCONC          *TYO            PURIFY
␈↓ ↓H␈↓ε                            *APPLY          *PLUS           FASLAPSETUP|    PUTDDTSYM
␈↓ ↓H␈↓ε                            *DELETE         *PRIN1          GCPROTECT       SQOZ|
␈↓ ↓H␈↓ε                            *DELQ           *PRINC          GETDDTSYM       TTSR|
␈↓ ↓H␈↓ε                            *EVAL           *PRINT          LAPSETUP|
␈↓ ↓H␈↓ε                            *GREAT          *TERPRI         PAGEBPORG
␈↓ ↓H␈↓ε                            *LESS           *TIMES          PURCOPY


␈↓ ↓H␈↓ε                        Internal system functions:

␈↓ ↓H␈↓ε                            +INTERNAL-'-MACRO          +INTERNAL-TTYSCAN-SUBR
␈↓ ↓H␈↓ε                            +INTERNAL-*RSET-BREAK      +INTERNAL-UBV-BREAK
␈↓ ↓H␈↓ε                            +INTERNAL-;-MACRO          +INTERNAL-UDF-BREAK
␈↓ ↓H␈↓ε                            +INTERNAL-AUTOLOAD         +INTERNAL-UGT-BREAK
␈↓ ↓H␈↓ε                            +INTERNAL-FAC-BREAK        +INTERNAL-UREAD-EOFFN
␈↓ ↓H␈↓ε                            +INTERNAL-GCL-BREAK        +INTERNAL-WNA-BREAK
␈↓ ↓H␈↓ε                            +INTERNAL-GCO-BREAK        +INTERNAL-WTA-BREAK
␈↓ ↓H␈↓ε                            +INTERNAL-INCLUDE-EOFFN    +INTERNAL-↑B-BREAK
␈↓ ↓H␈↓ε                            +INTERNAL-IOL-BREAK        +INTERNAL-↑Q-MACRO
␈↓ ↓H␈↓ε                            +INTERNAL-PDL-BREAK        +INTERNAL-↑S-MACRO
␈↓ ↓H␈↓ε                            +INTERNAL-TTY-ENDPAGEFN    +INTERNAL-|-MACRO
␈↓ ↓H␈↓iv␈↓ ¬pAppendix  A␈↓ H


␈↓ ↓H␈↓ε                        Internal system AUTOLOAD properties:

␈↓ ↓H␈↓ε                            NAME OF ATOM                   INITIAL VALUE

␈↓ ↓H␈↓ε                            |+INTERNAL-,-macro/||          ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |+INTERNAL-`-grindmacros/||    ((DSK MACLISP) GRINDEF FASL)
␈↓ ↓H␈↓ε                            |+INTERNAL-`-macro/||          ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |+INTERNAL-macro-loser/||      ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |+ibx/||                       ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |DEFMACRO MACRO|               ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            |DEFMACRO-DISPLACE MACRO|      ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            |DEFUN& MACRO|                 ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            |MACRO MACRO|                  ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            |MACRO-macroexpander/||        ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            |MACRO-macroexpander/| MACRO|   ((DSK MACLISP) DEFMACRO FASL)
␈↓ ↓H␈↓ε                            |MACROEXPANDED MACRO|          ((DSK MACLISP) DEFMAX FASL)
␈↓ ↓H␈↓ε                            |MACROEXPANDED-grindmacro/||   ((DSK MACLISP) DEFMAX FASL)
␈↓ ↓H␈↓ε                            |`,./||                        ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |`,@/||                        ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |`,/||                         ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |`-expander/||                 ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |`-expander/| MACRO|           ((DSK MACLISP) BACKQ FASL)
␈↓ ↓H␈↓ε                            |forget-macromemos/||          ((DSK MACLISP) DEFMAX FASL)


␈↓ ↓H␈↓ε                        System variables:

␈↓ ↓H␈↓ε                            NAME OF ATOM                   INITIAL VALUE

␈↓ ↓H␈↓ε                            $P                             $P
␈↓ ↓H␈↓ε                            *                              *
␈↓ ↓H␈↓ε                            *-READ-EVAL-PRINT              NIL
␈↓ ↓H␈↓ε                            *NOPOINT                       NIL
␈↓ ↓H␈↓ε                            *RSET                          T
␈↓ ↓H␈↓ε                            *RSET-TRAP                     +INTERNAL-*RSET-BREAK
␈↓ ↓H␈↓ε                            +                              +
␈↓ ↓H␈↓ε                            -                              -
␈↓ ↓H␈↓ε                            //                             NIL
␈↓ ↓H␈↓ε                            ARGS                           NIL
␈↓ ↓H␈↓ε                            AUTOLOAD                       +INTERNAL-AUTOLOAD
␈↓ ↓H␈↓ε                            BACKQUOTE-EXPAND-WHEN          EVAL
␈↓ ↓H␈↓ε                            BASE                           10
␈↓ ↓H␈↓ε                            CAR                            NIL
␈↓ ↓H␈↓ε                            CDR                            NIL
␈↓ ↓H␈↓ε                            CLI-MESSAGE                    NIL
␈↓ ↓H␈↓ε                            COMPILER-STATE                 NIL
␈↓ ↓H␈↓ε                            DEFAULTF                       ((DSK LOSER) @ @)
␈↓ ↓H␈↓ε                            DEFMACRO-CHECK-ARGS            T
␈↓ ↓H␈↓ε                            DEFMACRO-DISPLACE-CALL         T
␈↓ ↓H␈↓ε                            DEFMACRO-FOR-COMPILING         T
␈↓ ↓H␈↓ε                            DEFUN                          NIL
␈↓ ↓H␈↓ε                            DEFUN&-CHECK-ARGS              T
␈↓ ↓H␈↓ε                            DEFUN&-ERROR                   NIL
␈↓ ↓H␈↓ε                            ECHOFILES                      NIL
␈↓ ↓H␈↓ε                            EDIT                           NIL
␈↓ ↓H␈↓ε                            ERRLIST                        NIL
␈↓ ↓H␈↓ε                            ERROR-BREAK-ENVIRONMENT        (#OBARRAY-1200-64004 . 
␈↓ ↓H␈↓ε                        #READTABLE-0-64006)
␈↓ ↓H␈↓ε                            ERRSET                         NIL
␈↓ ↓H␈↓ε                            EVAL                           NIL
␈↓ ↓H␈↓ε                            EVALHOOK                       NIL
␈↓ ↓H␈↓ε                            FAIL-ACT                       +INTERNAL-FAC-BREAK
␈↓ ↓H␈↓ε                            FASLOAD                        (SUBR FSUBR LSUBR)
␈↓ ↓H␈↓ε                            GC-DAEMON                      NIL
␈↓ ↓H␈↓ε                            GC-LOSSAGE                     +INTERNAL-GCL-BREAK
␈↓ ↓H␈↓ε                            GC-OVERFLOW                    +INTERNAL-GCO-BREAK
␈↓ ↓H␈↓ε                            GCTWA                          NIL
␈↓ ↓H␈↓ε                            GRIND-MACROEXPANDED            NIL
␈↓ ↓H␈↓ε                            GRINDEF                        NIL
␈↓ ↓H␈↓␈↓ ¬pAppendix  A␈↓ 7v


␈↓ ↓H␈↓ε                            HUNKP                          T
␈↓ ↓H␈↓ε                            IBASE                          10
␈↓ ↓H␈↓ε                            INFILE                         T
␈↓ ↓H␈↓ε                            INSTACK                        NIL
␈↓ ↓H␈↓ε                            IO-LOSSAGE                     +INTERNAL-IOL-BREAK
␈↓ ↓H␈↓ε                            MACHINE-ERROR                  NIL
␈↓ ↓H␈↓ε                            MACRO-EXPANSION-USE            MACROEXPANDED
␈↓ ↓H␈↓ε                            MACROEXPANDED                  NIL
␈↓ ↓H␈↓ε                            MACROMEMO                      NIL
␈↓ ↓H␈↓ε                            MAKHUNK                        T
␈↓ ↓H␈↓ε                            MAR-BREAK                      NIL
␈↓ ↓H␈↓ε                            MSGFILES                       (T)
␈↓ ↓H␈↓ε                            NIL                            NIL
␈↓ ↓H␈↓ε                            NORET                          NIL
␈↓ ↓H␈↓ε                            NOUUO                          NIL
␈↓ ↓H␈↓ε                            OBARRAY                        #OBARRAY-1200-64004
␈↓ ↓H␈↓ε                            OUTFILES                       NIL
␈↓ ↓H␈↓ε                            PDL-OVERFLOW                   +INTERNAL-PDL-BREAK
␈↓ ↓H␈↓ε                            PRIN1                          NIL
␈↓ ↓H␈↓ε                            PRINLENGTH                     NIL
␈↓ ↓H␈↓ε                            PRINLEVEL                      NIL
␈↓ ↓H␈↓ε                            READ                           NIL
␈↓ ↓H␈↓ε                            READ-*-EVAL-PRINT              NIL
␈↓ ↓H␈↓ε                            READ-EVAL-*-PRINT              NIL
␈↓ ↓H␈↓ε                            READ-EVAL-PRINT-*              NIL
␈↓ ↓H␈↓ε                            READTABLE                      #READTABLE-0-64006
␈↓ ↓H␈↓ε                            SYMBOLS                        NIL
␈↓ ↓H␈↓ε                            SYS-DEATH                      NIL
␈↓ ↓H␈↓ε                            T                              T
␈↓ ↓H␈↓ε                            TERPRI                         NIL
␈↓ ↓H␈↓ε                            TTY                            17
␈↓ ↓H␈↓ε                            TTY-RETURN                     NIL
␈↓ ↓H␈↓ε                            TYI                            #FILE-IN-|PRIMARY:*.|-64012
␈↓ ↓H␈↓ε                            TYO                            #FILE-OUT-|PRIMARY:*.|-64014
␈↓ ↓H␈↓ε                            UNBND-VRBL                     +INTERNAL-UBV-BREAK
␈↓ ↓H␈↓ε                            UNDF-FNCTN                     +INTERNAL-UDF-BREAK
␈↓ ↓H␈↓ε                            UNSEEN-GO-TAG                  +INTERNAL-UGT-BREAK
␈↓ ↓H␈↓ε                            UREAD                          NIL
␈↓ ↓H␈↓ε                            UWRITE                         NIL
␈↓ ↓H␈↓ε                            WRNG-NO-ARGS                   +INTERNAL-WNA-BREAK
␈↓ ↓H␈↓ε                            WRNG-TYPE-ARG                  +INTERNAL-WTA-BREAK
␈↓ ↓H␈↓ε                            ZFUZZ                          NIL
␈↓ ↓H␈↓ε                            ZUNDERFLOW                     NIL
␈↓ ↓H␈↓ε                            ↑A                             NIL
␈↓ ↓H␈↓ε                            ↑D                             NIL
␈↓ ↓H␈↓ε                            ↑Q                             NIL
␈↓ ↓H␈↓ε                            ↑R                             NIL
␈↓ ↓H␈↓ε                            ↑W                             NIL
␈↓ ↓H␈↓ε                            |`-,-level/||                  0


␈↓ ↓H␈↓ε                        LAP and FASLOAD variables:

␈↓ ↓H␈↓ε                            NAME OF ATOM                   INITIAL VALUE

␈↓ ↓H␈↓ε                            *PURE                          NIL
␈↓ ↓H␈↓ε                            BPEND                          117707
␈↓ ↓H␈↓ε                            BPORG                          116153
␈↓ ↓H␈↓ε                            GCPROTECT                      NIL
␈↓ ↓H␈↓ε                            LAPSETUP/|                     NIL
␈↓ ↓H␈↓ε                            PURCLOBRL                      NIL
␈↓ ↓H␈↓ε                            PURE                           1
␈↓ ↓H␈↓ε                            PUTPROP                        (SUBR FSUBR LSUBR)
␈↓ ↓H␈↓ε                            TTSR/|                         12614